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 boolean | acceptsGzipEncoding(HttpServletRequest request)
Determine whether the user agent accepts GZIP encoding. |
protected void | doDestroy()
A template method that performs any Filter specific destruction tasks.
|
protected void | doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request. |
protected void | doInit()
Performs initialisation. |
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:
- Old browsers, notably IE 5 on Macintosh.
- Internet Explorer through a proxy. By default HTTP1.1 is enabled but disabled when going
through a proxy. 90% of non gzip requests seen on the Internet are caused by this.
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
protected void doDestroy()
A template method that performs any Filter specific destruction tasks.
Called from
GzipFilter
protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request.
protected void doInit()
Performs initialisation.