com.caucho.server.cache
Class ProxyCacheFilterChain

java.lang.Object
  extended by com.caucho.server.cache.AbstractCacheFilterChain
      extended by com.caucho.server.cache.ProxyCacheFilterChain
All Implemented Interfaces:
CauchoFilterChain, CacheListener, FilterChain

public class ProxyCacheFilterChain
extends AbstractCacheFilterChain
implements CacheListener, CauchoFilterChain

Represents the proxy cache in a filter chain.


Constructor Summary
ProxyCacheFilterChain(Cache cache, FilterChain next, WebApp webApp)
          Create the filter chain servlet.
ProxyCacheFilterChain(FilterChain next, WebApp webApp)
          Create the filter chain servlet.
 
Method Summary
 void clearExpires()
          Clears the expires timers
 void doFilter(ServletRequest request, ServletResponse response)
          Handles caching for the filter.
 ProxyCacheEntry fillEntry(CauchoRequest req, CauchoResponse res, java.util.ArrayList<java.lang.String> keys, java.util.ArrayList<java.lang.String> values, java.lang.String contentType, java.lang.String charEncoding, long contentLength)
           
 boolean fillFromCache(CauchoRequest req, CauchoResponse response, AbstractCacheEntry abstractEntry)
          fillFromCache is called when the client needs the entire result, and the result is already in the cache.
 void finishCaching(CauchoResponse res)
          Update the headers when the caching has finished.
 long getHitCount()
           
 FilterChain getNext()
           
 java.lang.String getUri()
           
 WebApp getWebApp()
           
 void killCaching(CauchoResponse res)
          Update the headers when the caching has finished.
 void removeEvent()
          Callback when the item has been removed from the cache, usually because of an LRU event.
 AbstractCacheEntry startCaching(CauchoRequest req, CauchoResponse res, java.util.ArrayList<java.lang.String> keys, java.util.ArrayList<java.lang.String> values, java.lang.String contentType, java.lang.String charEncoding, long contentLength)
          Starts the caching after the headers have been sent.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProxyCacheFilterChain

public ProxyCacheFilterChain(FilterChain next,
                             WebApp webApp)
Create the filter chain servlet.


ProxyCacheFilterChain

public ProxyCacheFilterChain(Cache cache,
                             FilterChain next,
                             WebApp webApp)
Create the filter chain servlet.

Method Detail

getHitCount

public long getHitCount()

getWebApp

public WebApp getWebApp()

getUri

public java.lang.String getUri()

getNext

public FilterChain getNext()
Specified by:
getNext in interface CauchoFilterChain

clearExpires

public void clearExpires()
Clears the expires timers


doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response)
              throws ServletException,
                     java.io.IOException
Handles caching for the filter.

Specified by:
doFilter in interface FilterChain
Parameters:
req - the servlet request
res - the servlet response
Throws:
ServletException
java.io.IOException

fillFromCache

public boolean fillFromCache(CauchoRequest req,
                             CauchoResponse response,
                             AbstractCacheEntry abstractEntry)
                      throws java.io.IOException
fillFromCache is called when the client needs the entire result, and the result is already in the cache.

Specified by:
fillFromCache in class AbstractCacheFilterChain
Parameters:
req - the servlet request trying to get data from the cache
response - the servlet response which will receive data
entry - the cache entry to use
isSyntheticHeader - if false, the not-modified should be sent to the browser
Throws:
java.io.IOException

startCaching

public AbstractCacheEntry startCaching(CauchoRequest req,
                                       CauchoResponse res,
                                       java.util.ArrayList<java.lang.String> keys,
                                       java.util.ArrayList<java.lang.String> values,
                                       java.lang.String contentType,
                                       java.lang.String charEncoding,
                                       long contentLength)
Starts the caching after the headers have been sent.

Specified by:
startCaching in class AbstractCacheFilterChain
Parameters:
req - the servlet request
req - the servlet response
keys - the saved header keys
values - the saved header values
contentType - the response content type
charEncoding - the response character encoding
Returns:
the inode to store the cache value or null if uncacheable.

fillEntry

public ProxyCacheEntry fillEntry(CauchoRequest req,
                                 CauchoResponse res,
                                 java.util.ArrayList<java.lang.String> keys,
                                 java.util.ArrayList<java.lang.String> values,
                                 java.lang.String contentType,
                                 java.lang.String charEncoding,
                                 long contentLength)

finishCaching

public void finishCaching(CauchoResponse res)
Update the headers when the caching has finished.

Specified by:
finishCaching in class AbstractCacheFilterChain
Parameters:
okay - if true, the cache if valid

killCaching

public void killCaching(CauchoResponse res)
Update the headers when the caching has finished.

Specified by:
killCaching in class AbstractCacheFilterChain
Parameters:
okay - if true, the cache if valid

removeEvent

public void removeEvent()
Callback when the item has been removed from the cache, usually because of an LRU event.

Specified by:
removeEvent in interface CacheListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object