com.xucia.resourceaccelerate
Class CompressAndCacheHeadersFilter

java.lang.Object
  extended by com.xucia.resourceaccelerate.CacheHeadersFilter
      extended by com.xucia.resourceaccelerate.CompressAndCacheHeadersFilter
All Implemented Interfaces:
javax.servlet.Filter

public class CompressAndCacheHeadersFilter
extends CacheHeadersFilter

Author:
Kris Zyp This is a filter that gzips files and stores a copy of the compressed file so that compression only needs to take place once. It also extends CacheHeadersFilter to add caching headers to the response.

Nested Class Summary
static class CompressAndCacheHeadersFilter.RedirectedOutputStream
           
static class CompressAndCacheHeadersFilter.RequestModifiedSinceWrapper
          This class changes the request to have an if-modified-since header to see if the content has changed
static class CompressAndCacheHeadersFilter.StatusMonitorResponseWrapper
          This class utilizes code from ehcache: http://ehcache.sourceforge.net/ This class monitors the status code and redirects the output stream
 
Field Summary
static java.lang.String DEFAULT_CACHE_FOLDER
           
 
Constructor Summary
CompressAndCacheHeadersFilter()
           
 
Method Summary
 void doFilter(javax.servlet.ServletRequest genericRequest, javax.servlet.ServletResponse genericResponse, javax.servlet.FilterChain chain)
          Filter handling mechanism to intercept requests and see if they have new content and do the compression
 void init(javax.servlet.FilterConfig config)
          Read the configuration parameters
 
Methods inherited from class com.xucia.resourceaccelerate.CacheHeadersFilter
destroy, setCacheHeader, setCacheHeader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CACHE_FOLDER

public static final java.lang.String DEFAULT_CACHE_FOLDER
See Also:
Constant Field Values
Constructor Detail

CompressAndCacheHeadersFilter

public CompressAndCacheHeadersFilter()
Method Detail

doFilter

public void doFilter(javax.servlet.ServletRequest genericRequest,
                     javax.servlet.ServletResponse genericResponse,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Filter handling mechanism to intercept requests and see if they have new content and do the compression

Specified by:
doFilter in interface javax.servlet.Filter
Overrides:
doFilter in class CacheHeadersFilter
Throws:
java.io.IOException
javax.servlet.ServletException

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Read the configuration parameters

Specified by:
init in interface javax.servlet.Filter
Overrides:
init in class CacheHeadersFilter
Throws:
javax.servlet.ServletException