DLESE Tools
v1.6.0

org.dlese.dpc.webapps.servlets.filters
Class GzipFilter

java.lang.Object
  extended by org.dlese.dpc.webapps.servlets.filters.FilterCore
      extended by org.dlese.dpc.webapps.servlets.filters.GzipFilter
All Implemented Interfaces:
Filter

public final class GzipFilter
extends FilterCore

Performs gzipping of the response content. This is implemented using servlet response Filter that takes the reqular ouput of a JSP or servlet and converts it into a GZIP output stream. By encoding the output as GZIP, the size of thresponse can be reduced by as much as 300%.

Version:
$Id: GzipFilter.java,v 1.11 2009/03/20 23:34:01 jweather Exp $
Author:
John Weatherley

Constructor Summary
GzipFilter()
           
 
Method Summary
 void destroy()
          Destroy is called at application shut-down time.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          Performs gzipping of the response content.
 void init(FilterConfig config)
          Init is called once at application start-up.
protected static void prtln(String s)
          Output a line of text to standard out, with datestamp, if debug is set to true.
protected  void prtlnErr(String s)
          Output a line of text to error out, with datestamp.
protected  void setDebugzz(boolean db)
          Sets the debug attribute of the GzipFilter object
 
Methods inherited from class org.dlese.dpc.webapps.servlets.filters.FilterCore
getDateStamp, handleErrorCodes, isGzipSupported, prtlnCore, writeGzipResponse, writeRegularResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GzipFilter

public GzipFilter()
Method Detail

doFilter

public final void doFilter(ServletRequest request,
                           ServletResponse response,
                           FilterChain chain)
                    throws ServletException,
                           IOException
Performs gzipping of the response content.

Parameters:
request - The request
response - The response
chain - The chain of filters
Throws:
ServletException - If problem occurs
IOException - If IO problem occurs

init

public void init(FilterConfig config)
          throws ServletException
Init is called once at application start-up.

Parameters:
config - The FilterConfig object that holds the ServletContext and init information.
Throws:
ServletException - If an error occurs

destroy

public void destroy()
Destroy is called at application shut-down time.


prtlnErr

protected final void prtlnErr(String s)
Output a line of text to error out, with datestamp.

Parameters:
s - The text that will be output to error out.

prtln

protected static final void prtln(String s)
Output a line of text to standard out, with datestamp, if debug is set to true.

Parameters:
s - The String that will be output.

setDebugzz

protected final void setDebugzz(boolean db)
Sets the debug attribute of the GzipFilter object

Parameters:
db - The new debug value

DLESE Tools
v1.6.0