org.mortbay.servlet
public class GzipFilter extends UserAgentFilter
minGzipSize initParameter or the minGzipSize is 0(default)mimeTypes initParameter or
if no mimeTypes are defined the content-type is not "application/gzip"
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 org.mortbay.jetty.servlet.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.
| Modifier and Type | Class and Description |
|---|---|
class |
GzipFilter.GZIPResponseWrapper |
static class |
GzipFilter.GzipStream |
| Modifier and Type | Field and Description |
|---|---|
protected int |
_bufferSize |
protected java.util.Set |
_excluded |
protected java.util.Set |
_mimeTypes |
protected int |
_minGzipSize |
| Constructor and Description |
|---|
GzipFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
doFilter(ServletRequest req,
ServletResponse res,
FilterChain chain) |
void |
init(FilterConfig filterConfig) |
protected GzipFilter.GZIPResponseWrapper |
newGZIPResponseWrapper(HttpServletRequest request,
HttpServletResponse response) |
protected java.io.PrintWriter |
newWriter(java.io.OutputStream out,
java.lang.String encoding) |
getUserAgent, getUserAgentprotected java.util.Set _mimeTypes
protected int _bufferSize
protected int _minGzipSize
protected java.util.Set _excluded
public void init(FilterConfig filterConfig) throws ServletException
init in interface Filterinit in class UserAgentFilterServletExceptionpublic void destroy()
destroy in interface Filterdestroy in class UserAgentFilterpublic void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws java.io.IOException, ServletException
doFilter in interface FilterdoFilter in class UserAgentFilterjava.io.IOExceptionServletExceptionprotected GzipFilter.GZIPResponseWrapper newGZIPResponseWrapper(HttpServletRequest request, HttpServletResponse response)
protected java.io.PrintWriter newWriter(java.io.OutputStream out,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionCopyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.