Creating a Taxonomic e-Science

org.cateproject.view.cache
Class CateCachingFilter

java.lang.Object
  extended by org.cateproject.view.cache.CateCachingFilter
Direct Known Subclasses:
CdmObjectPageCacheImpl, PageCachingFilter

public abstract class CateCachingFilter
extends Object


Constructor Summary
CateCachingFilter()
           
 
Method Summary
protected  boolean acceptsEncoding(HttpServletRequest request, String name)
          Checks if request accepts the named encoding.
protected  boolean acceptsGzipEncoding(HttpServletRequest request)
           
protected  net.sf.ehcache.constructs.web.PageInfo buildPage(HttpServletRequest request, HttpServletResponse response, FilterChain chain, long timeToLiveSeconds)
          Builds the PageInfo object by passing the request along the filter chain
protected  net.sf.ehcache.constructs.web.PageInfo buildPageInfo(String key, net.sf.ehcache.Ehcache cache, HttpServletRequest request, HttpServletResponse response, FilterChain chain)
           
protected abstract  String calculateKey(HttpServletRequest httpRequest)
           
protected  void doFilterInternal(String key, net.sf.ehcache.Ehcache cache, HttpServletRequest request, HttpServletResponse response, FilterChain chain)
           
abstract  boolean filter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
           
protected  void logRequestHeaders(HttpServletRequest request)
          Logs the request headers, if debug is enabled.
protected  void setContentType(HttpServletResponse response, net.sf.ehcache.constructs.web.PageInfo pageInfo)
           
protected  void setCookies(net.sf.ehcache.constructs.web.PageInfo pageInfo, HttpServletResponse response)
           
protected  void setHeaders(net.sf.ehcache.constructs.web.PageInfo pageInfo, boolean requestAcceptsGzipEncoding, HttpServletResponse response)
           
protected  void setStatus(HttpServletResponse response, net.sf.ehcache.constructs.web.PageInfo pageInfo)
           
protected  void writeContent(HttpServletRequest request, HttpServletResponse response, net.sf.ehcache.constructs.web.PageInfo pageInfo)
           
protected  void writeResponse(HttpServletRequest request, HttpServletResponse response, net.sf.ehcache.constructs.web.PageInfo pageInfo)
          Writes the response from a PageInfo object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CateCachingFilter

public CateCachingFilter()
Method Detail

filter

public abstract boolean filter(HttpServletRequest request,
                               HttpServletResponse response,
                               FilterChain chain)
                        throws Exception
Throws:
Exception

calculateKey

protected abstract String calculateKey(HttpServletRequest httpRequest)
                                throws Exception
Throws:
Exception

doFilterInternal

protected void doFilterInternal(String key,
                                net.sf.ehcache.Ehcache cache,
                                HttpServletRequest request,
                                HttpServletResponse response,
                                FilterChain chain)
                         throws Exception
Throws:
Exception

buildPageInfo

protected net.sf.ehcache.constructs.web.PageInfo buildPageInfo(String key,
                                                               net.sf.ehcache.Ehcache cache,
                                                               HttpServletRequest request,
                                                               HttpServletResponse response,
                                                               FilterChain chain)
                                                        throws Exception
Throws:
Exception

buildPage

protected net.sf.ehcache.constructs.web.PageInfo buildPage(HttpServletRequest request,
                                                           HttpServletResponse response,
                                                           FilterChain chain,
                                                           long timeToLiveSeconds)
                                                    throws net.sf.ehcache.constructs.web.AlreadyGzippedException,
                                                           Exception
Builds the PageInfo object by passing the request along the filter chain

Parameters:
request -
response -
chain -
Returns:
a Serializable value object for the page or page fragment
Throws:
net.sf.ehcache.constructs.web.AlreadyGzippedException - if an attempt is made to double gzip the body
Exception

writeResponse

protected void writeResponse(HttpServletRequest request,
                             HttpServletResponse response,
                             net.sf.ehcache.constructs.web.PageInfo pageInfo)
                      throws IOException,
                             DataFormatException,
                             net.sf.ehcache.constructs.web.ResponseHeadersNotModifiableException
Writes the response from a PageInfo object.

Headers are set last so that there is an opportunity to override

Parameters:
request -
response -
pageInfo -
Throws:
IOException
DataFormatException
net.sf.ehcache.constructs.web.ResponseHeadersNotModifiableException

setCookies

protected void setCookies(net.sf.ehcache.constructs.web.PageInfo pageInfo,
                          HttpServletResponse response)

setHeaders

protected void setHeaders(net.sf.ehcache.constructs.web.PageInfo pageInfo,
                          boolean requestAcceptsGzipEncoding,
                          HttpServletResponse response)

setContentType

protected void setContentType(HttpServletResponse response,
                              net.sf.ehcache.constructs.web.PageInfo pageInfo)

setStatus

protected void setStatus(HttpServletResponse response,
                         net.sf.ehcache.constructs.web.PageInfo pageInfo)

acceptsGzipEncoding

protected boolean acceptsGzipEncoding(HttpServletRequest request)

acceptsEncoding

protected boolean acceptsEncoding(HttpServletRequest request,
                                  String name)
Checks if request accepts the named encoding.


writeContent

protected void writeContent(HttpServletRequest request,
                            HttpServletResponse response,
                            net.sf.ehcache.constructs.web.PageInfo pageInfo)
                     throws IOException,
                            net.sf.ehcache.constructs.web.ResponseHeadersNotModifiableException
Throws:
IOException
net.sf.ehcache.constructs.web.ResponseHeadersNotModifiableException

logRequestHeaders

protected void logRequestHeaders(HttpServletRequest request)
Logs the request headers, if debug is enabled.

Parameters:
request -

Creating a Taxonomic e-Science

Copyright © 2010. All Rights Reserved.