|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.webSvr.util.CompressionFilter
public final class CompressionFilter
Implementation of javax.servlet.Filter used to compress
the ServletResponse if it is bigger than a threshold.
We might need to modify this to suppress caching for HTTP/1.0 clients (eg by setting Pragma: no-cache and Expires: 0).
| Field Summary | |
|---|---|
private static java.lang.String |
ANTI_DUP_ATTR_NAME
Name of attribute that we use to avoid duplicate application of this filter on one filter chain. |
protected int |
compressionThreshold
The threshold result size below which not to try to compress. |
private javax.servlet.FilterConfig |
config
The filter configuration object we are associated with. |
private int |
debug
Debug level for this filter. |
(package private) static java.lang.String |
GZIP_TOKEN
Encoding token indicating that GZIP compression is accepted. |
private WebUtils.ServletLoggerWithFallback |
logger
Our logger which falls back to System.out if servlet log not available; never null. |
private java.lang.String |
overrideAttribute
The name of the application-level attribute to disable compression if Boolean.FALSE, or null. |
private StatsLogger.StatsConfig |
statsIDCompression
The stats set to which we log HTTP gzip-(un)compressed-transport counts. |
| Constructor Summary | |
|---|---|
CompressionFilter()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Take this filter out of service. |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Filters the server operation. |
javax.servlet.FilterConfig |
getFilterConfig()
|
void |
init(javax.servlet.FilterConfig filterConfig)
Place this filter into service. |
void |
setFilterConfig(javax.servlet.FilterConfig c)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final java.lang.String GZIP_TOKEN
private final WebUtils.ServletLoggerWithFallback logger
private final StatsLogger.StatsConfig statsIDCompression
We may enable or disable this logging (etc) from system parameters, but this is nonetheless our unique identifier.
private javax.servlet.FilterConfig config
private java.lang.String overrideAttribute
protected int compressionThreshold
private int debug
private static final java.lang.String ANTI_DUP_ATTR_NAME
| Constructor Detail |
|---|
public CompressionFilter()
| Method Detail |
|---|
public javax.servlet.FilterConfig getFilterConfig()
public void setFilterConfig(javax.servlet.FilterConfig c)
public void init(javax.servlet.FilterConfig filterConfig)
init in interface javax.servlet.FilterfilterConfig - The filter configuration objectpublic void destroy()
destroy in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws java.io.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 supports compression.
It passes the request and response unaltered if there is no support for compression.
If compression support is available, this filter 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.Filterjava.io.IOException
javax.servlet.ServletException
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||