com.opensymphony.oscache.web.filter
Class ResponseContent

java.lang.Object
  extended bycom.opensymphony.oscache.web.filter.ResponseContent
All Implemented Interfaces:
java.io.Serializable

public class ResponseContent
extends java.lang.Object
implements java.io.Serializable

Holds the servlet response in a byte array so that it can be held in the cache (and, since this class is serializable, optionally persisted to disk).

Version:
$Revision: 1.1 $
Author:
Serge Knystautas
See Also:
Serialized Form

Constructor Summary
ResponseContent()
           
 
Method Summary
 void commit()
          Called once the response has been written in its entirety.
 java.io.OutputStream getOutputStream()
          Get an output stream.
 int getSize()
          Gets the size of this cached content.
 void setContentType(java.lang.String value)
          Set the content type.
 void setLocale(java.util.Locale value)
          Set the Locale.
 void writeTo(javax.servlet.ServletResponse response)
          Writes this cached data out to the supplied ServletResponse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseContent

public ResponseContent()
Method Detail

setContentType

public void setContentType(java.lang.String value)
Set the content type. We capture this so that when we serve this data from cache, we can set the correct content type on the response.


setLocale

public void setLocale(java.util.Locale value)
Set the Locale. We capture this so that when we serve this data from cache, we can set the correct locale on the response.


getOutputStream

public java.io.OutputStream getOutputStream()
Get an output stream. This is used by the SplitServletOutputStream to capture the original (uncached) response into a byte array.


getSize

public int getSize()
Gets the size of this cached content.

Returns:
The size of the content, in bytes. If no content exists, this method returns -1.

commit

public void commit()
Called once the response has been written in its entirety. This method commits the response output stream by converting the output stream into a byte array.


writeTo

public void writeTo(javax.servlet.ServletResponse response)
             throws java.io.IOException
Writes this cached data out to the supplied ServletResponse.

Parameters:
response - The servlet response to output the cached content to.
Throws:
java.io.IOException

See www.opensymphony.com for more information.