Hello Takenori,

you can use the Encoder filter (http://www.restlet.org/documentation/1.1/nre/com/noelios/restlet/application/Encoder.html) which is able to compress automatically the response's entity according to the client's preferences (based on the header "accept-encoding"). This filters lets the resource (or the Restlet) generate its (decompressed) representation without taking into account such issues.
Is it what your are looking for?

best regards,
Thierry Boileau
Hi, Thanks to Restlet, I enjoy REST world in Java :)

I design a huge financial data REST service, with spreadsheet-like front end by gwt on client.

To maximize the throuput, I am going to prepare GZIPed JSON on NAS.
1. Database -> JDBC -> JSON -> GZIP -> Client
2. JSON -> GZIP -> Client
3. GZIP -> Client

With EncodeRepresentation, I was able to implement 1 and 2. But I can not find a clear way to do 3, EncodeRepresentation#write looks related, though.
Could you suggest a way to achieve something like this?

e.g. GZippedJSONResource
* if client supports GZIP, the content is directly sent, otherwise, it is extracted, then is transformed appropriately.
#represent:
File f = new File(new URI(gzippedJSONURI));
GZippedJSONRepresentation gjr = new GZippedJSONRepresentation(f);
return gjr;

Best,
Takenori


Reply via email to