org.apache.cocoon.caching
Class CachedResponse

java.lang.Object
  extended by org.apache.cocoon.caching.CachedResponse
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CachedSourceResponse

public class CachedResponse
extends Object
implements Serializable

This is a cached response. This can either contain a byte array with the complete character response or a byte array with compiled SAX events. This class replaces the CachedEventObject and the CachedStreamObject.

Since:
2.1
Version:
CVS $Id: CachedResponse.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler
See Also:
Serialized Form

Field Summary
protected  String contentType
           
protected  Long expires
           
protected  long lastModified
           
protected  byte[] response
           
protected  SourceValidity[] validityObjects
           
 
Constructor Summary
CachedResponse(SourceValidity[] validityObjects, byte[] response)
          Create a new entry for the cache.
CachedResponse(SourceValidity[] validityObjects, byte[] response, Long expires)
          Create a new entry for the cache.
CachedResponse(SourceValidity validityObject, byte[] response)
          Create a new entry for the cache.
 
Method Summary
 String getContentType()
           
 Long getExpires()
          Get the configured expires.
 long getLastModified()
           
 byte[] getResponse()
          Get the cached response.
 SourceValidity[] getValidityObjects()
          Get the validity objects
 void setContentType(String value)
           
 void setExpires(Long newExpires)
          Set the (newly) configured expires.
protected  long setLastModified(long lastModified)
          Set the (newly) configured last modified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validityObjects

protected final SourceValidity[] validityObjects

response

protected final byte[] response

expires

protected Long expires

lastModified

protected final long lastModified

contentType

protected String contentType
Constructor Detail

CachedResponse

public CachedResponse(SourceValidity[] validityObjects,
                      byte[] response)
Create a new entry for the cache.

Parameters:
validityObjects - The SourceValidity objects in the order they occured in the pipeline
response - The cached sax stream or character stream

CachedResponse

public CachedResponse(SourceValidity validityObject,
                      byte[] response)
Create a new entry for the cache.

Parameters:
validityObject - The SourceValidity object
response - The cached sax stream or character stream

CachedResponse

public CachedResponse(SourceValidity[] validityObjects,
                      byte[] response,
                      Long expires)
Create a new entry for the cache.

Parameters:
validityObjects - The SourceValidity objects in the order they occured in the pipeline
response - The cached sax stream or character stream
expires - The configured expires, or null if no expires was defined.
Method Detail

getValidityObjects

public SourceValidity[] getValidityObjects()
Get the validity objects


getResponse

public byte[] getResponse()
Get the cached response.

Returns:
The sax stream or character stream

getExpires

public Long getExpires()
Get the configured expires.

Returns:
The configured expires, or null if no expires was defined

setExpires

public void setExpires(Long newExpires)
Set the (newly) configured expires.


setLastModified

protected long setLastModified(long lastModified)
Set the (newly) configured last modified.


getLastModified

public long getLastModified()
Returns:
the last modified time

getContentType

public String getContentType()
Returns:
Returns the cached content type (or null).

setContentType

public void setContentType(String value)
Parameters:
value - The content type to cache.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.