net.sf.ehcache.constructs.web.filter
Class SimplePageCachingFilterWithBlankPageProblem
java.lang.Object
net.sf.ehcache.constructs.web.filter.Filter
net.sf.ehcache.constructs.web.filter.CachingFilter
net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter
net.sf.ehcache.constructs.web.filter.SimplePageCachingFilterWithBlankPageProblem
- All Implemented Interfaces:
- javax.servlet.Filter
public class SimplePageCachingFilterWithBlankPageProblem
- extends SimplePageCachingFilter
This implementation only writes the response when it is not committed. This is half
right. In the wild it can cause the dreaded blank page problem.
Another half right solution is to write the response. The problem then is,
if the response is gzipped, the body might be gzipped but the headers won't show it.
The result will be yet another blank page in Internet Explorer.
The correct thing to do is to throw an exception.
- Version:
- $Id: SimplePageCachingFilterWithBlankPageProblem.java 796 2008-10-09 02:39:03Z gregluck $
- Author:
- Greg Luck
- See Also:
SimplePageCachingFilter
|
Field Summary |
static String |
NAME
The name of the filter. |
|
Method Summary |
protected void |
doFilter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
Performs the filtering for a request. |
| Methods inherited from class net.sf.ehcache.constructs.web.filter.CachingFilter |
buildPage, buildPageInfo, checkNoReentry, doDestroy, doInit, setCacheNameIfAnyConfigured, setContentType, setCookies, setHeaders, setStatus, writeContent, writeResponse |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME
public static final String NAME
- The name of the filter. This should match a cache name in ehcache.xml
- See Also:
- Constant Field Values
SimplePageCachingFilterWithBlankPageProblem
public SimplePageCachingFilterWithBlankPageProblem()
doFilter
protected void doFilter(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.FilterChain chain)
throws Exception
- Performs the filtering for a request. This method caches based responses
keyed by
CachingFilter.calculateKey(javax.servlet.http.HttpServletRequest)
By default this method will queue requests requesting the page response
for a given key until the first thread in the queue has completed. The
request which occurs when the page expires incurs the cost of waiting for
the downstream processing to return the respone.
The maximum time to wait can be configured by setting
setTimeoutMillis on the underlying
BlockingCache.
- Overrides:
doFilter in class CachingFilter
- 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.
net.sf.ehcache.constructs.blocking.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.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
Copyright © 2003-2011 Terracotta, Inc.. All Rights Reserved.