Package com.twelvemonkeys.servlet.cache
Class CacheFilter
- java.lang.Object
-
- com.twelvemonkeys.servlet.GenericFilter
-
- com.twelvemonkeys.servlet.cache.CacheFilter
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.Filter,javax.servlet.FilterConfig
public class CacheFilter extends GenericFilter
A Filter that provides response caching, for HTTPGETrequests.Originally based on ideas and code found in the ONJava article Two Servlet Filters Every Web Application Should Have by Jayson Falkner.
- Version:
- $Id: CacheFilter.java#4 $
- Author:
- Jayson Falkner, Harald Kuhr, last modified by $Author: haku $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.twelvemonkeys.servlet.GenericFilter
oncePerRequest
-
-
Constructor Summary
Constructors Constructor Description CacheFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Called by the web container to indicate to a filter that it is being taken out of service.protected voiddoFilterImpl(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse, javax.servlet.FilterChain pChain)Invoked once, or each time a request/response pair is passed through the chain, depending on theGenericFilter.oncePerRequestmember variable.voidinit()Initializes the filter-
Methods inherited from class com.twelvemonkeys.servlet.GenericFilter
doFilter, getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, log, log, setFilterConfig, setOncePerRequest
-
-
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletExceptionInitializes the filter- Overrides:
initin classGenericFilter- Throws:
javax.servlet.ServletException- See Also:
GenericFilter.init(FilterConfig)
-
destroy
public void destroy()
Description copied from class:GenericFilterCalled by the web container to indicate to a filter that it is being taken out of service.- Specified by:
destroyin interfacejavax.servlet.Filter- Overrides:
destroyin classGenericFilter- See Also:
Filter.destroy()
-
doFilterImpl
protected void doFilterImpl(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse, javax.servlet.FilterChain pChain) throws java.io.IOException, javax.servlet.ServletExceptionDescription copied from class:GenericFilterInvoked once, or each time a request/response pair is passed through the chain, depending on theGenericFilter.oncePerRequestmember variable.- Specified by:
doFilterImplin classGenericFilter- Parameters:
pRequest- the servlet requestpResponse- the servlet responsepChain- the filter chain- Throws:
java.io.IOException- if an I/O error occursjavax.servlet.ServletException- if an exception occurs during the filter process- See Also:
GenericFilter.oncePerRequest,doFilter,Filter.doFilter
-
-