httpgzipjavalite

Can I make Javalite Http unpack replies that are gziped?


I am using Javalite Http client to make a post request to a REST service and would like to get the result gziped (as it can be quite large and compresses well).

I am reading the reply with the post.text() method but the result seems to be the compressed data rather than the actual text data I expected to get.

Is there a way to make Javalite transparently unpack the response when the service reply is compressed or is it by design that I need to check if the reply is compressed and in that case myself find a way to decompress it?


Solution

  • In the current implementation, JavaLite HTTP does not process responses in any way, and considers such processing (zip, JSON, XML, etc) a responsibility of the developer. You can inspect the headers of the response by using the headers() method and see if it was zipped.

    However, JavaLite is constantly improving. I suggest you file an issue as an enhancement here: https://github.com/javalite/activejdbc/issues.