I have tried many different things here, googled extensively and while almost
there, still need the last centimeter to get it working.
Basicly I want to post some binary data from an java applet, but the applet
part is irrelevant, for proof of concept i am POSTing from a standalone java
client.
This is the client code.
URL url = new URL("http://somesite");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setFixedLengthStreamingMode(6);
OutputStream out = null;
out = conn.getOutputStream();
out.write("hello\n".getBytes());
out.flush();
Now, on the out.flush() My wicket page get hit fine, heres the page (extends
WebPage)
public MyWicketPage(final PageParameters parameters) {
WebRequest wr = (WebRequest) getRequest();
HttpServletRequest hsr = wr.getHttpServletRequest();
if (hsr.getMethod().equalsIgnoreCase("post")) {
byte[] data = IOUtils.toByteArray(hsr.getInputStream());
logger.trace("!! "+data.length);
}
}
Problem is that data.length is 0, there is nothing in the stream.
So I am obviosly doing something very wrong .. Pointers please ? :-)
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Reading-POST-data-from-standalone-application-tp4657664.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]