info.magnolia.module.cache.filter
Class DelegatingBlobCachedEntry

java.lang.Object
  extended by info.magnolia.module.cache.filter.ContentCachedEntry
      extended by info.magnolia.module.cache.filter.DelegatingBlobCachedEntry
All Implemented Interfaces:
CachedEntry, Serializable

public class DelegatingBlobCachedEntry
extends ContentCachedEntry

Used for large responses. Typically we don't want to cache big responses as they are so costly to keep in memory and tend to evict so much from the cache where they're put in that net performance drops. This cache entry does not keep the response in memory, instead it serves it from a file on disk or if there's no file it proceeds with rendering. When it has used the file once it deletes it. The entry still remains in cache and serves as a token to prevent caching in the future. The file is created by CacheResponseWrapper when it reaches its set threshold.

Version:
$Id$
See Also:
CacheResponseWrapper, Serialized Form

Field Summary
static String CONTENT_FILE_ATTRIBUTE
           
 
Constructor Summary
DelegatingBlobCachedEntry(long contentLength, String contentType, String characterEncoding, int statusCode, org.apache.commons.collections.MultiMap headers, long modificationDate, String originalUrl, int timeToLiveInSeconds)
           
 
Method Summary
 void bindContentFileToCurrentRequest(javax.servlet.http.HttpServletRequest request, File contentFile)
           
protected  boolean canServeGzipContent()
           
 void replay(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
           
protected  void writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain, boolean acceptsGzipEncoding)
           
 
Methods inherited from class info.magnolia.module.cache.filter.ContentCachedEntry
addHeaders, getCharacterEncoding, getContentType, getHeaders, getLastModificationTime, getOriginalURL, getStatusCode, getTimeToLiveInSeconds, isAcceptsGzip, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTENT_FILE_ATTRIBUTE

public static final String CONTENT_FILE_ATTRIBUTE
Constructor Detail

DelegatingBlobCachedEntry

public DelegatingBlobCachedEntry(long contentLength,
                                 String contentType,
                                 String characterEncoding,
                                 int statusCode,
                                 org.apache.commons.collections.MultiMap headers,
                                 long modificationDate,
                                 String originalUrl,
                                 int timeToLiveInSeconds)
                          throws IOException
Throws:
IOException
Method Detail

canServeGzipContent

protected boolean canServeGzipContent()
Specified by:
canServeGzipContent in class ContentCachedEntry

replay

public void replay(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response,
                   javax.servlet.FilterChain chain)
            throws IOException,
                   javax.servlet.ServletException
Specified by:
replay in interface CachedEntry
Overrides:
replay in class ContentCachedEntry
chain - a cache entry might want to delegate to the filter chain, see replay(HttpServletRequest, HttpServletResponse, FilterChain)
Throws:
IOException
javax.servlet.ServletException

writeContent

protected void writeContent(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response,
                            javax.servlet.FilterChain chain,
                            boolean acceptsGzipEncoding)
                     throws IOException,
                            javax.servlet.ServletException
Specified by:
writeContent in class ContentCachedEntry
Throws:
IOException
javax.servlet.ServletException

bindContentFileToCurrentRequest

public void bindContentFileToCurrentRequest(javax.servlet.http.HttpServletRequest request,
                                            File contentFile)


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.