de.neteye.actioncache
Class ActionCacheItem

java.lang.Object
  |
  +--de.neteye.actioncache.AbstractCacheItem
        |
        +--de.neteye.actioncache.ActionCacheItem
All Implemented Interfaces:
CacheItem, java.io.Serializable

public class ActionCacheItem
extends AbstractCacheItem

CacheItem implementation that is backed by a file. The lastModified and the contentType properties are kept in memory and are serialized by the default java serialization mechanism. The actual content is read from a file to avoid the overhead of object deserialization on each request.
If URL rewriting is used to track the session, the sessionId is replaced by a special token in the cache file. When such an item is send to a client, the token is replaced by the current sessionId.
If the sessionId comes from a cookie or the action outputs binary data, a direct stream copy is performed instead of using Readers/Writers to improve performance. To handle different encodings please use a servlet filter.

Version:
$Revision: 1.3 $
Author:
Felix Gnass
See Also:
Serialized Form

Constructor Summary
ActionCacheItem(java.lang.Object key, java.io.File cacheDir)
           
 
Method Summary
 java.lang.String getContentType()
           
 long getLastModified()
           
 boolean isNew()
           
 void setContentType(java.lang.String contentType)
           
 void setLastModified(long lastModified)
           
 void setValue(byte[] data)
           
 void setValue(char[] data, javax.servlet.http.HttpServletRequest request)
           
 void writeTo(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletResponse response)
           
 
Methods inherited from class de.neteye.actioncache.AbstractCacheItem
getKey, getNext, getPrevious, hashCode, setKey, setNext, setPrevious
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionCacheItem

public ActionCacheItem(java.lang.Object key,
                       java.io.File cacheDir)
                throws java.io.IOException
See Also:
ActionCache.createCacheItem(java.lang.Object)
Method Detail

setContentType

public void setContentType(java.lang.String contentType)

getContentType

public java.lang.String getContentType()

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface CacheItem
Specified by:
getLastModified in class AbstractCacheItem

setLastModified

public void setLastModified(long lastModified)

isNew

public boolean isNew()

setValue

public void setValue(byte[] data)
              throws java.io.IOException
java.io.IOException

setValue

public void setValue(char[] data,
                     javax.servlet.http.HttpServletRequest request)
              throws java.io.IOException
java.io.IOException

writeTo

public void writeTo(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.ServletResponse response)
             throws java.io.IOException
java.io.IOException