dev@grizzly.java.net

compression on http/servlet module

From: rama <rama.rama_at_tiscali.it>
Date: Sat, 5 Mar 2011 11:14:46 +0100

Hi guys,


i am trying to enable compression on http/servlet module, but i am facing some problem.


basically the output isn't compressed :D

let's start from the beginning

On
detectCompression() --> processorTask.java
i notice a

MessageBytes acceptEncodingMB =
            request.getMimeHeaders().getValue("accept-encoding");

on firefox i got "gzip,deflate"

now, goto
lookupCompressionFilter(MessageBytes encoding) (same class)

encoding is "gzip,deflate" (no parse to acceptEncodingMB are do on the lines before)

on this function with some breakpoint i have see

filter.getEcodingName().equalsIgnoreCasE("gzip,deflate")

and, my filters are...
com.sun.grizzly.tcp.http11.filters.GzipOutputFilter_at_57ee026e --> getEncodingName "gzip" (not equals)
com.sun.grizzly.tcp.http11.filters.GzipOutputFilter_at_4b9cee52 --> getEncodingName "gzip" (not equals) (why i have two objects there? strange...hash of this objs are different)
com.sun.grizzly.tcp.http11.filters.LzmaOutputFilter_at_2ad67f82 --> lzma (not equals)
void
chunked
identity


this is the configuration of GWS


        GrizzlyWebServer gws = new GrizzlyWebServer(Config.getInt("www_port"), root.getAbsolutePath());

        gws.getSelectorThread().setCompression("on");
        gws.getSelectorThread().setCompressionMinSize(1024);
        gws.getSelectorThread().setCompressableMimeTypes("text/javascript,text/css,text/html");

        gws.addGrizzlyAdapter(new ServletAdapter(new JspAdapter()), new String[]{"/*.jsp", "/*.css"});
        gws.addGrizzlyAdapter(new StaticAdapter(), new String[]{"/"});



Let me finalize my question
1) due to missing filter, the compression isn't working as i expect.
2) why i have 2 gzipoutputfilter ? that's sound strange (but maybe is totally normal, i haven't crawl on the code enough)
3) why "accept-encoding" isn't splitted and then parsed?


have a nice weekend!