public class CompressionFilter extends Object implements javax.servlet.Filter
javax.servlet.Filter used to compress
the ServletResponse if it is bigger than a threshold.| Modifier and Type | Field and Description |
|---|---|
protected int |
compressionBuffer
The compression buffer size to avoid chunking.
|
protected String[] |
compressionMimeTypes
The mime types to compress.
|
protected int |
compressionThreshold
The threshold number to compress.
|
| Constructor and Description |
|---|
CompressionFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Take this filter out of service.
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
The
doFilter method of the Filter is called by the container
each time a request/response pair is passed through the chain due
to a client request for a resource at the end of the chain. |
javax.servlet.FilterConfig |
getFilterConfig()
Return filter config
Required by Weblogic 6.1
|
void |
init(javax.servlet.FilterConfig filterConfig)
Place this filter into service.
|
void |
setFilterConfig(javax.servlet.FilterConfig filterConfig)
Set filter config
This function is equivalent to init.
|
protected int compressionThreshold
protected int compressionBuffer
protected String[] compressionMimeTypes
public void init(javax.servlet.FilterConfig filterConfig)
init in interface javax.servlet.FilterfilterConfig - The filter configuration objectpublic void destroy()
destroy in interface javax.servlet.Filterpublic void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
doFilter method of the Filter is called by the container
each time a request/response pair is passed through the chain due
to a client request for a resource at the end of the chain.
The FilterChain passed into this method allows the Filter to pass on the
request and response to the next entity in the chain.
This method first examines the request to check whether the client support
compression.
It simply just pass the request and response if there is no support for
compression.
If the compression support is available, it creates a
CompressionServletResponseWrapper object which compresses the content and
modifies the header if the content length is big enough.
It then invokes the next entity in the chain using the FilterChain object
(chain.doFilter()),
doFilter in interface javax.servlet.FilterIOExceptionjavax.servlet.ServletExceptionpublic void setFilterConfig(javax.servlet.FilterConfig filterConfig)
filterConfig - The filter configuration objectpublic javax.servlet.FilterConfig getFilterConfig()
Copyright © 2015 WSO2 Inc. All rights reserved.