org.eclipse.jetty.servlets
Class GzipFilter

java.lang.Object
  extended by org.eclipse.jetty.servlets.UserAgentFilter
      extended by org.eclipse.jetty.servlets.GzipFilter
All Implemented Interfaces:
Filter
Direct Known Subclasses:
IncludableGzipFilter

public class GzipFilter
extends UserAgentFilter

GZIP Filter This filter will gzip the content of a response iff:

Compressing the content can greatly improve the network bandwidth usage, but at a cost of memory and CPU cycles. If this filter is mapped for static content, then use of efficient direct NIO may be prevented, thus use of the gzip mechanism of the DefaultServlet is advised instead.

This filter extends UserAgentFilter and if the the initParameter excludedAgents is set to a comma separated list of user agents, then these agents will be excluded from gzip content.


Nested Class Summary
 class GzipFilter.GZIPResponseWrapper
           
static class GzipFilter.GzipStream
           
 
Field Summary
protected  int _bufferSize
           
protected  Set _excluded
           
protected  Set _mimeTypes
           
protected  int _minGzipSize
           
 
Constructor Summary
GzipFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
           
 void init(FilterConfig filterConfig)
           
protected  GzipFilter.GZIPResponseWrapper newGZIPResponseWrapper(HttpServletRequest request, HttpServletResponse response)
           
protected  PrintWriter newWriter(OutputStream out, String encoding)
           
 
Methods inherited from class org.eclipse.jetty.servlets.UserAgentFilter
getUserAgent, getUserAgent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mimeTypes

protected Set _mimeTypes

_bufferSize

protected int _bufferSize

_minGzipSize

protected int _minGzipSize

_excluded

protected Set _excluded
Constructor Detail

GzipFilter

public GzipFilter()
Method Detail

init

public void init(FilterConfig filterConfig)
          throws ServletException
Specified by:
init in interface Filter
Overrides:
init in class UserAgentFilter
Throws:
ServletException

destroy

public void destroy()
Specified by:
destroy in interface Filter
Overrides:
destroy in class UserAgentFilter

doFilter

public void doFilter(ServletRequest req,
                     ServletResponse res,
                     FilterChain chain)
              throws IOException,
                     ServletException
Specified by:
doFilter in interface Filter
Overrides:
doFilter in class UserAgentFilter
Throws:
IOException
ServletException

newGZIPResponseWrapper

protected GzipFilter.GZIPResponseWrapper newGZIPResponseWrapper(HttpServletRequest request,
                                                                HttpServletResponse response)

newWriter

protected PrintWriter newWriter(OutputStream out,
                                String encoding)
                         throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.