net.sf.ehcache.constructs.web.filter

Class PageFragmentCachingFilter

public abstract class PageFragmentCachingFilter extends CachingFilter

A Template for a page caching filter that is designed for "included" pages, eg: jsp:includes. This filter differs from the CachingFilter in that it is not writing an entire response to the output stream.

This class should be sub-classed for each included page to be cached.

Filter Mappings need to be set up for a cache to have effect.

Version: $Id: PageFragmentCachingFilter.java 70 2006-05-07 11:50:02Z gregluck $

Author: Greg Luck

Method Summary
protected PageInfobuildPage(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
protected voiddoFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request.
protected voidwriteResponse(HttpServletResponse response, PageInfo pageInfo)
Assembles a response from a cached page include.

Method Detail

buildPage

protected PageInfo buildPage(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
{@inheritDoc }

Parameters: request {@inheritDoc } response {@inheritDoc } chain {@inheritDoc }

Returns: {@inheritDoc }

Throws: AlreadyGzippedException {@inheritDoc } Exception {@inheritDoc }

doFilter

protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
Performs the filtering for a request.

writeResponse

protected void writeResponse(HttpServletResponse response, PageInfo pageInfo)
Assembles a response from a cached page include. These responses are never gzipped The content length should not be set in the response, because it is a fragment of a page. Don't write any headers at all.