2 Replies Latest reply on Oct 10, 2016 4:41 AM by ant1g

    Undertow Gzip Content-Encoding with Chuncked Transfer-Encoding

    ant1g

      Hello,

       

      I am using the Undertow EncodingHandler with a Gzip Content repository, as follows (sample code taken from a unit test):

       

      final EncodingHandler handler = 
          new EncodingHandler(new ContentEncodingRepository()
            .addEncodingHandler("gzip", 
                new GzipEncodingProvider(), 50,
                Predicates.parse("max-content-size[5]")))
            .setNext(path);
      

       

      It works fine for very small response bodies, however, when Undertow starts to use the Chunked Transfer-Encoding, the Gzip compression is simply ignored.

      My question is basically: how to apply a Gzip encoding (or other compression) before Undertow starts chunking the response?

       

      Also, and I could not really track it down from the source code, how does Undertow decide to start chunking the response?

       

      Thanks!

       

      Best regards,

      Antoine