Hello Peter,
do you tried to close the outputStream?
I don't know if the OutputStream created by the HttpConnection handles
the chunked encoding, or if you must do this by hand.
Do you thought to use the Restlet on client side? Or is this to big for
the mobile phone?
BTW, if you know the media type ("image/jpeg" or whatever) you can use
it instead of "application/octet-stream"
best regards
Stephan
Hi,
I am trying to get over image data from a mobile phone using a very simple model
where the data is sent as, according to the restlet Request headers,
Content-Type: application/octet-stream
Transfer-Encoding: chunked
And the code sending it from the phone looks like
conn = (HttpConnection) Connector.open(restServiceUrl);
conn.setRequestMethod(HttpConnection.POST);
os = conn.openOutputStream();
os.write(data); //data is a byte array
os.flush();
However, using this code in my Resource:
public void post(Representation entity) {
Request request = getRequest();
System.out.println("request: " + request.getAttributes()
InputRepresentation input = (InputRepresentation) entity;
System.out.println("Input length: " + input.getSize());
gives me imput.getSize() of -1.
Is ther eanything that sits between me and the data? Is there any way to get to
the raw data that is coming over the stream? Am I using the wrong calls?