Hi everyone,

We are developing a new product which consist of a server and several mobile 
clients. We chose RESTlet to develop both the server (hosted on Google 
AppEngine) and the Android client part and we are running into several problems 
with it.

Communication happens through some POJOs which are de/serialized to JSON by 
ConverterService (we are using the "Jackson" extension).

We are using an approach similar to the one described in "First Application" 
[1] tutorial: POJOs + interfaces + ServerResources implementing the interfaces 
and ClientResources wrap()'ing the interfaces.

The Android client sends raw Java serialization data 
(application/x-java-serialized-object) instead.

Everything works fine on the local AppEngine's development server.

But, as soon as we deploy it to GAE, both the test suite and the client don't 
work. On the server side, the deserialized POJOs become NULs, thus we get a lot 
of Null-pointer execptions. I managed to track the source of the problem to the 
"Transfer-Encoding: chunked" header added by the RESTlet ClientResource.

After some tests (done with curl) it seems that the server somehow trashes 
variable-length requests and can't deserialize the JSON representation sent 
this way. Sending a fixed-length request with a defined Content-Length header 
doesn't trigger the problem and the server works fine.

Because of this, the Android client doesn't work either since it sends the 
serialized objects wrapped in a chunked request. As a work-around I tried to 
force the client to send JSON representations but I can't seem to be able to 
instruct the ConverterService to prefer JSON instead of the binary 
representation.

We don't know if this is a RESTlet bug or a problem on GAE side (but I suppose 
it's their fault).

So far I have envisioned only two ways to overcome this situation:
- Write an alternative JacksonRepresentation (+ Converter) which sends 
fixed-length entities so that RESTlet doesn't wrap them in a chunked request 
and figure out how to instruct the ConverterService on Android to use it. This 
is probably the cleanest way (provided that ConverterService on Android works 
as expected).
- Throw away the POJOs (on client side, at least), use StringRepresentations 
everywhere and manually serialize/deserialize the POJOs in the request handler.


Any idea?


Regards,
Lorenzo V.

_________
[1] 
http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2701359

Reply via email to