net.sf.ehcache.constructs.web.filter
public abstract class CachingFilter extends Filter
Version: $Id: CachingFilter.java 191 2006-09-03 22:41:48Z gregluck $
Field Summary | |
---|---|
protected BlockingCache | blockingCache
The cache holding the web pages. |
Method Summary | |
---|---|
protected PageInfo | buildPage(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Builds the PageInfo object by passing the request along the filter chain
|
protected PageInfo | buildPageInfo(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Build page info either using the cache or building the page directly.
|
protected abstract String | calculateKey(HttpServletRequest httpRequest)
CachingFilter works off a key.
|
protected void | checkNoReentry(HttpServletRequest httpRequest)
Check that this caching filter is not being reentered by the same recursively.
|
protected void | doDestroy()
Destroys the filter. |
protected void | doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request.
|
void | doInit()
Initialises blockingCache to use. |
protected abstract CacheManager | getCacheManager()
Gets the CacheManager for this CachingFilter. |
protected abstract String | getCacheName()
A meaningful name representative of the JSP page being cached.
|
protected void | setContentType(HttpServletResponse response, PageInfo pageInfo)
Set the content type
|
protected void | setCookies(PageInfo pageInfo, HttpServletResponse response)
Set the serializableCookies
|
protected void | setHeaders(PageInfo pageInfo, boolean requestAcceptsGzipEncoding, HttpServletResponse response)
Set the headers in the response object, excluding the Gzip header
|
protected void | setStatus(HttpServletResponse response, PageInfo pageInfo)
Status code
|
protected void | writeContent(HttpServletRequest request, HttpServletResponse response, PageInfo pageInfo)
Writes the response content.
|
protected void | writeResponse(HttpServletRequest request, HttpServletResponse response, PageInfo pageInfo)
Writes the response from a PageInfo object.
|
Parameters: request response chain
Returns: a Serializable value object for the page or page fragment
Throws: AlreadyGzippedException if an attempt is made to double gzip the body Exception
Parameters: httpRequest
Returns: the key, generally the URL plus request parameters
Parameters: httpRequest
Throws: FilterNonReentrantException if reentry is detected
Parameters: request response chain
Throws: AlreadyGzippedException if a double gzip is attempted AlreadyCommittedException if the response was committed on the way in or the on the way back FilterNonReentrantException if an attempt is made to reenter this filter in the same request. LockTimeoutException if this request is waiting on another that is populating the cache entry and timeouts while waiting. Only occurs if the BlockingCache has a timeout set. Exception for all other exceptions. They will be caught and logged in Filter
blockingCache.setTimeoutMillis(int timeout)
and takes effect immediately
for all new requests
Throws: CacheException The most likely cause is that a cache has not been configured in ehcache's configuration file ehcache.xml for the filter name
Returns: the CacheManager to be used
Since: 1.2.1
Returns: the name of the cache to use for this filter.
Parameters: response pageInfo
Parameters: pageInfo response
Parameters: pageInfo requestAcceptsGzipEncoding response
Parameters: response pageInfo
Parameters: response pageInfo
Throws: IOException
Parameters: request response pageInfo
Throws: IOException DataFormatException ResponseHeadersNotModifiableException