Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 25 lines (17 sloc) 0.78 kb

The NetSpade Compression Filter

Jason Davies

This is a useful Java Servlet 2.3 filter that detects if the browser supports a GZIP encoded response. If so, it compresses the output on-the-fly using GZIP.

To use this filter, simply copy netspade-compression-filter.jar from dist/ into the /WEB-INF/lib/ directory of your Web application.

Enable the filter in your deployment descriptor, web.xml:

<filter>
    <filter-name>compress</filter-name>
    <filter-class>com.netspade.servlet.compress.CompressionFilter</filter-class>
</filter>

Map the filter to a URL pattern:

<filter-mapping>
    <filter-name>compress</filter-name>
    <url-pattern>*.jsp</url-pattern>
</filter-mapping>
Jump to Line
Something went wrong with that request. Please try again.