Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

compressionFilters
Class CompressionFilter  view CompressionFilter download CompressionFilter.java

java.lang.Object
  extended bycompressionFilters.CompressionFilter
All Implemented Interfaces:
javax.servlet.Filter

public class CompressionFilter
extends java.lang.Object
implements javax.servlet.Filter

Implementation of javax.servlet.Filter used to compress the ServletResponse if it is bigger than a threshold.

Version:
$Revision: 267129 $, $Date: 2004-03-18 11:40:35 -0500 (Thu, 18 Mar 2004) $

Field Summary
protected  int compressionThreshold
          The threshold number to compress
private  javax.servlet.FilterConfig config
          The filter configuration object we are associated with.
private  int debug
          Debug level for this filter
private  int minThreshold
          Minimal reasonable threshold
 
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)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

private javax.servlet.FilterConfig config
The filter configuration object we are associated with. If this value is null, this filter instance is not currently configured.


minThreshold

private int minThreshold
Minimal reasonable threshold


compressionThreshold

protected int compressionThreshold
The threshold number to compress


debug

private int debug
Debug level for this filter

Constructor Detail

CompressionFilter

public CompressionFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig)
Place this filter into service.

Specified by:
init in interface javax.servlet.Filter

destroy

public void destroy()
Take this filter out of service.

Specified by:
destroy in interface javax.servlet.Filter

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
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. 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()),

Specified by:
doFilter in interface javax.servlet.Filter

setFilterConfig

public void setFilterConfig(javax.servlet.FilterConfig filterConfig)
Set filter config This function is equivalent to init. Required by Weblogic 6.1


getFilterConfig

public javax.servlet.FilterConfig getFilterConfig()
Return filter config Required by Weblogic 6.1