net.sf.ehcache.constructs.web.filter

Class GzipFilter

public class GzipFilter extends Filter

Provides GZIP compression of responses.

See the filter-mappings.xml entry for the gzip filter for the URL patterns which will be gzipped. At present this includes .jsp, .js and .css.

Version: $Id: GzipFilter.java 80 2006-05-14 03:16:22Z gregluck $

Author: Greg Luck Adam Murdoch

Method Summary
protected booleanacceptsGzipEncoding(HttpServletRequest request)
Determine whether the user agent accepts GZIP encoding.
protected voiddoDestroy()
A template method that performs any Filter specific destruction tasks.
protected voiddoFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request.
protected voiddoInit()
Performs initialisation.

Method Detail

acceptsGzipEncoding

protected boolean acceptsGzipEncoding(HttpServletRequest request)
Determine whether the user agent accepts GZIP encoding. This feature is part of HTTP1.1. If a browser accepts GZIP encoding it will advertise this by including in its HTTP header:

Accept-Encoding: gzip

Requests which do not accept GZIP encoding fall into the following categories:

As of September 2004, about 34% of Internet requests do not accept GZIP encoding.

Parameters: request

Returns: true, if the User Agent request accepts GZIP encoding

doDestroy

protected void doDestroy()
A template method that performs any Filter specific destruction tasks. Called from GzipFilter

doFilter

protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request.

doInit

protected void doInit()
Performs initialisation.