views:

10

answers:

1

In a servelt application, I've added a Gzip filter (/*, REQUEST) and config it be the first in the filter chain. It works fine with Sitemesh's filter (/*, REQUEST, FORWARD) except that when the request is excluded as specified in deocorators.xml (e.g. for ajax request), the gzip filter throws an illegal state.

The gzip filter comes from http://jsp.codefetch.com/example/54/CompressionFilter/src/CompressionResponseWrapper.java

A: 

I'd rather configure Gzipping at servletcontainer level. Every self-respected servletcontainer supports it. Since it's unclear which one you're using and Tomcat is the most popular/cloned/forked one, here's a Tomcat targeted example so that you at least have a clue where to look in your servletcontainer.

Open /conf/server.xml, locate the <Connector> element and add compression="on" to it.

<Connector (...) compression="on" />

That's it.

BalusC
We are using jetty, which seems to be using GZipFilter.
jackysee