org.jasig.resourceserver.utils.filter
Class CacheExpirationFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.jasig.resourceserver.utils.filter.CacheExpirationFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.context.ServletContextAware

public class CacheExpirationFilter
extends org.springframework.web.filter.GenericFilterBean

CacheExpirationFilter sets a far-future expiration timeout on the HTTP response of the filtered resource. This filter is intended for resources which will not be changed, such as versioned javascript and css files. Any resources protected by this filter should be renamed upon update. init-params:
cacheMaxAge - Sets the max age in seconds to be used in the cache headers for cached resources, defaults to 1 year (31536000).
regenerateHeadersInterval - The interval in milliseconds to regenerate the cache headers, defaults to 1 second (1000).

Author:
Jen Bourey

Field Summary
protected  org.slf4j.Logger logger
           
 
Constructor Summary
CacheExpirationFilter()
           
 
Method Summary
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          
 int getCacheMaxAge()
           
protected  void initFilterBean()
           
 void setCacheMaxAge(int cacheMaxAge)
           
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, setBeanName, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Constructor Detail

CacheExpirationFilter

public CacheExpirationFilter()
Method Detail

getCacheMaxAge

public int getCacheMaxAge()

setCacheMaxAge

public void setCacheMaxAge(int cacheMaxAge)
Parameters:
cacheMaxAge - Sets the max age in seconds to be used in the cache headers for cached resources, defaults to 1 year (31536000)

initFilterBean

protected void initFilterBean()
                       throws javax.servlet.ServletException
Overrides:
initFilterBean in class org.springframework.web.filter.GenericFilterBean
Throws:
javax.servlet.ServletException

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException

Throws:
IOException
javax.servlet.ServletException


Copyright © 2010 Jasig. All Rights Reserved.