Question

I have a WCF Data Service that sends data with GZip. I intend to use odata4j to read that compressed stream. If it is not compressed, it works fine. What should I modify to be able to read the compressed stream via odata4j?

Here is the C# code that compresses the stream:

 HttpContext httpContext = HttpContext.Current;
      if (httpContext != null)
        httpContext.Response.Filter = new GZipStream(httpContext.Response.Filter, CompressionMode.Compress);

And here is the Odata4j part that reads the data:

 ODataConsumer consumer = ODataJerseyConsumer.create(url);
 List<OEntity> listEntities=consumer.getEntities("Data")
          .execute().toList();
Was it helpful?

Solution

Odata4j supports compressed content download, no additional configuration is required. However, the uncompression task consumes so much CPU time, that the time gained by the lesser data transfer is almost completely wasted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top