Package com.twelvemonkeys.servlet.cache
Interface WritableCachedResponse
-
- All Superinterfaces:
CacheResponse
public interface WritableCachedResponse extends CacheResponse
WritableCachedResponse- Version:
- $Id: WritableCachedResponse.java#2 $
- Author:
- Harald Kuhr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddHeader(java.lang.String pName, java.lang.String pValue)Adds a header key/value pair for this response.com.twelvemonkeys.servlet.cache.CachedResponsegetCachedResponse()Returns the final (immutable)CachedResponsecreated by thisWritableCachedResponse.java.lang.String[]getHeaderNames()Gets the header names of all headers set in this response.java.lang.StringgetHeaderValue(java.lang.String pHeaderName)Gets the first header value set for the given header in this response.java.lang.String[]getHeaderValues(java.lang.String pHeaderName)Gets all header values set for the given header in this response.java.io.OutputStreamgetOutputStream()Gets theOutputStreamfor this cached response.intgetStatus()voidsetHeader(java.lang.String pName, java.lang.String pValue)Sets a header key/value pair for this response.intsize()Returns the size of this cached response in bytes.voidwriteContentsTo(java.io.OutputStream pStream)Writes the cahced content to the responsevoidwriteHeadersTo(CacheResponse pResponse)Writes the cached headers to the response-
Methods inherited from interface com.twelvemonkeys.servlet.cache.CacheResponse
getHeaders, getStatus, setStatus
-
-
-
-
Method Detail
-
getOutputStream
java.io.OutputStream getOutputStream()
Gets theOutputStreamfor this cached response. This allows a client to write to the cached response.- Specified by:
getOutputStreamin interfaceCacheResponse- Returns:
- the
OutputStreamfor this response.
-
setHeader
void setHeader(java.lang.String pName, java.lang.String pValue)Sets a header key/value pair for this response. Any prior header value for the given header key will be overwritten.- Specified by:
setHeaderin interfaceCacheResponse- Parameters:
pName- the header namepValue- the header value- See Also:
addHeader(String, String)
-
addHeader
void addHeader(java.lang.String pName, java.lang.String pValue)Adds a header key/value pair for this response. If a value allready exists for the given key, the value will be appended.- Specified by:
addHeaderin interfaceCacheResponse- Parameters:
pName- the header namepValue- the header value- See Also:
setHeader(String, String)
-
getCachedResponse
com.twelvemonkeys.servlet.cache.CachedResponse getCachedResponse()
Returns the final (immutable)CachedResponsecreated by thisWritableCachedResponse.- Returns:
- the
CachedResponse
-
writeHeadersTo
void writeHeadersTo(CacheResponse pResponse)
Writes the cached headers to the response- Parameters:
pResponse- the servlet response
-
writeContentsTo
void writeContentsTo(java.io.OutputStream pStream) throws java.io.IOExceptionWrites the cahced content to the response- Parameters:
pStream- the response output stream- Throws:
java.io.IOException- if an I/O exception occurs during write
-
getStatus
int getStatus()
-
getHeaderNames
java.lang.String[] getHeaderNames()
Gets the header names of all headers set in this response.- Returns:
- an array of
Strings
-
getHeaderValues
java.lang.String[] getHeaderValues(java.lang.String pHeaderName)
Gets all header values set for the given header in this response. If the header is not set,nullis returned.- Parameters:
pHeaderName- the header name- Returns:
- an array of
Strings, ornullif there is no such header in this response.
-
getHeaderValue
java.lang.String getHeaderValue(java.lang.String pHeaderName)
Gets the first header value set for the given header in this response. If the header is not set,nullis returned. Useful for headers that don't have multiple values, like"Content-Type"or"Content-Length".- Parameters:
pHeaderName- the header name- Returns:
- a
String, ornullif there is no such header in this response.
-
size
int size()
Returns the size of this cached response in bytes.- Returns:
- the size
-
-