[undertow-dev] Combining encoding handlers with non-encoding handlers

Stuart Douglas sdouglas at redhat.com
Mon Aug 10 02:09:30 EDT 2015


Just add the encoding handler to the appropriate prefix path, instead of making it the root handler, e.g. 

.addPrefixPath("/pathA", new EncodingHandler ....)

Stuart 

----- Original Message -----
> From: "Girish Sharma" <scrapmachines at gmail.com>
> To: undertow-dev at lists.jboss.org
> Sent: Friday, 7 August, 2015 12:40:10 AM
> Subject: [undertow-dev] Combining encoding handlers with non-encoding	handlers
> 
> Hi team,
> 
> I am trying to have a situation like this:
> 
> Path A - response is gzipped,
> Path B - response is not gzipped.
> 
> But from extensive searching, I could only figure out a way to make all paths
> as gzipped response.
> 
> For example:
> 
> Undertow . builder ().addHttpListener(8080, "localhost").setHandler( new
> EncodingHandler( new ContentEncodingRepository().addEncodingHandler(
> "gzip" ,
> new GzipEncodingProvider(),
> 50 ,
> Predicates. parse ( "max-content-size[5]" )
> )
> ).setNext(Handlers. path ()
> .addPrefixPath("/pathA", pathA ::handle)
> .addPrefixPath("/pathB", pathAB::handle
> )).build();
> 
> will make both Path A and Path B as gzip encoded response.
> 
> Any way to make only 1 of them give gzipped response?
> 
> Regards
> --
> Girish Sharma
> B.Tech(H), Civil Engineering ,
> Indian Institute of Technology, Kharagpur
> 
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list