|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.ServletResponseWrapper
javax.servlet.http.HttpServletResponseWrapper
com.sun.appserv.web.cache.filter.CachingResponseWrapper
public class CachingResponseWrapper
a wrapper to HttpServletResponse to cache the outbound headers and content
and
,
HttpServletResponse
,
org.apache.catalina.connector.HttpResponseBase
Field Summary |
---|
Constructor Summary | |
---|---|
CachingResponseWrapper(HttpServletResponse response)
Constructs a response adaptor wrapping the given response. |
Method Summary | |
---|---|
void |
addCookie(Cookie cookie)
The default behavior of this method is to call addCookie(Cookie cookie) on the wrapped response object. |
void |
addDateHeader(String name,
long value)
Add the specified date header to the specified value. |
void |
addHeader(String name,
String value)
Add the specified header to the specified value. |
void |
addIntHeader(String name,
int value)
Add the specified integer header to the specified value. |
HttpCacheEntry |
cacheResponse()
called by doFilter to cache the response that was just sent out |
void |
clear()
clear the contents of this wrapper |
Long |
getExpiresDateHeader()
return the Expires: date header value |
ServletOutputStream |
getOutputStream()
Return the servlet output stream associated with this Response. |
PrintWriter |
getWriter()
Return the writer associated with this Response. |
boolean |
isError()
has the response been set to error |
void |
sendError(int status)
Send an error response with the specified status and a default message. |
void |
sendError(int status,
String message)
Send an error response with the specified status and message. |
void |
setContentLength(int len)
Set the content length (in bytes) for this Response. |
void |
setContentType(String type)
Set the content type for this Response. |
void |
setDateHeader(String name,
long value)
Set the specified date header to the specified value. |
void |
setHeader(String name,
String value)
Set the specified header to the specified value. |
void |
setIntHeader(String name,
int value)
Set the specified integer header to the specified value. |
void |
setLocale(Locale locale)
Set the Locale that is appropriate for this response, including setting the appropriate character encoding. |
void |
setStatus(int sc)
Set the HTTP status to be returned with this response. |
Methods inherited from class javax.servlet.http.HttpServletResponseWrapper |
---|
containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendRedirect, setStatus |
Methods inherited from class javax.servlet.ServletResponseWrapper |
---|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.ServletResponse |
---|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding |
Constructor Detail |
---|
public CachingResponseWrapper(HttpServletResponse response)
IllegalArgumentException
- if the response is nullMethod Detail |
---|
public ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface ServletResponse
getOutputStream
in class ServletResponseWrapper
ServletOutputStream
for writing binary data
IllegalStateException
- if getWriter
has
already been called for this response
IOException
- if an input/output error occursServletResponse.getWriter()
public PrintWriter getWriter() throws IOException
getWriter
in interface ServletResponse
getWriter
in class ServletResponseWrapper
PrintWriter
object that
can return character data to the client
IllegalStateException
- if getOutputStream
has
already been called for this response
IOException
- if an input/output error occursServletResponse.getOutputStream()
,
ServletResponse.setCharacterEncoding(java.lang.String)
public void setContentLength(int len)
setContentLength
in interface ServletResponse
setContentLength
in class ServletResponseWrapper
len
- The new content lengthpublic void setContentType(String type)
setContentType
in interface ServletResponse
setContentType
in class ServletResponseWrapper
type
- The new content typeServletResponse.setLocale(java.util.Locale)
,
ServletResponse.setCharacterEncoding(java.lang.String)
,
ServletResponse.getOutputStream()
,
ServletResponse.getWriter()
public void setLocale(Locale locale)
setLocale
in interface ServletResponse
setLocale
in class ServletResponseWrapper
locale
- The new localeServletResponse.getLocale()
,
ServletResponse.setContentType(java.lang.String)
,
ServletResponse.setCharacterEncoding(java.lang.String)
public void addCookie(Cookie cookie)
addCookie
in interface HttpServletResponse
addCookie
in class HttpServletResponseWrapper
cookie
- the Cookie to return to the clientpublic void setHeader(String name, String value)
setHeader
in interface HttpServletResponse
setHeader
in class HttpServletResponseWrapper
name
- Name of the header to setvalue
- Value to be setHttpServletResponse.containsHeader(java.lang.String)
,
HttpServletResponse.addHeader(java.lang.String, java.lang.String)
public void setIntHeader(String name, int value)
setIntHeader
in interface HttpServletResponse
setIntHeader
in class HttpServletResponseWrapper
name
- Name of the header to setvalue
- Integer value to be setHttpServletResponse.containsHeader(java.lang.String)
,
HttpServletResponse.addIntHeader(java.lang.String, int)
public void addHeader(String name, String value)
addHeader
in interface HttpServletResponse
addHeader
in class HttpServletResponseWrapper
name
- Name of the header to setvalue
- Value to be setHttpServletResponse.setHeader(java.lang.String, java.lang.String)
public void addIntHeader(String name, int value)
addIntHeader
in interface HttpServletResponse
addIntHeader
in class HttpServletResponseWrapper
name
- Name of the header to setvalue
- Integer value to be setHttpServletResponse.setIntHeader(java.lang.String, int)
public void setDateHeader(String name, long value)
setDateHeader
in interface HttpServletResponse
setDateHeader
in class HttpServletResponseWrapper
name
- Name of the header to setvalue
- Date value to be setHttpServletResponse.containsHeader(java.lang.String)
,
HttpServletResponse.addDateHeader(java.lang.String, long)
public void addDateHeader(String name, long value)
addDateHeader
in interface HttpServletResponse
addDateHeader
in class HttpServletResponseWrapper
name
- Name of the header to setvalue
- Date value to be setHttpServletResponse.setDateHeader(java.lang.String, long)
public void setStatus(int sc)
setStatus
in interface HttpServletResponse
setStatus
in class HttpServletResponseWrapper
sc
- The new HTTP statusHttpServletResponse.sendError(int, java.lang.String)
public void sendError(int status) throws IOException
sendError
in interface HttpServletResponse
sendError
in class HttpServletResponseWrapper
status
- HTTP status code to send
IllegalStateException
- if this response has
already been committed
IOException
- if an input/output error occurspublic void sendError(int status, String message) throws IOException
sendError
in interface HttpServletResponse
sendError
in class HttpServletResponseWrapper
status
- HTTP status code to sendmessage
- Corresponding message to send
IllegalStateException
- if this response has
already been committed
IOException
- if an input/output error occurspublic boolean isError()
public Long getExpiresDateHeader()
public HttpCacheEntry cacheResponse() throws IOException
IOException
public void clear()
|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2006 Sun Microsystems, Inc. All rights reserved.