public class CachingResponseWrapper
extends javax.servlet.http.HttpServletResponseWrapper
and,
HttpServletResponseSC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY| Constructor and Description |
|---|
CachingResponseWrapper(javax.servlet.http.HttpServletResponse response)
Constructs a response adaptor wrapping the given response.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCookie(javax.servlet.http.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
|
javax.servlet.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.
|
containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getHeader, getHeaderNames, getHeaders, getStatus, sendRedirect, setStatusflushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, isWrapperFor, isWrapperFor, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLengthLong, setResponsepublic CachingResponseWrapper(javax.servlet.http.HttpServletResponse response)
IllegalArgumentException - if the response is nullpublic javax.servlet.ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface javax.servlet.ServletResponsegetOutputStream in class javax.servlet.ServletResponseWrapperIllegalStateException - if getWriter has
already been called for this responseIOException - if an input/output error occurspublic PrintWriter getWriter() throws IOException
getWriter in interface javax.servlet.ServletResponsegetWriter in class javax.servlet.ServletResponseWrapperIllegalStateException - if getOutputStream has
already been called for this responseIOException - if an input/output error occurspublic void setContentLength(int len)
setContentLength in interface javax.servlet.ServletResponsesetContentLength in class javax.servlet.ServletResponseWrapperlen - The new content lengthpublic void setContentType(String type)
setContentType in interface javax.servlet.ServletResponsesetContentType in class javax.servlet.ServletResponseWrappertype - The new content typepublic void setLocale(Locale locale)
setLocale in class javax.servlet.ServletResponseWrapperlocale - The new localepublic void addCookie(javax.servlet.http.Cookie cookie)
addCookie in interface javax.servlet.http.HttpServletResponseaddCookie in class javax.servlet.http.HttpServletResponseWrapperpublic void setHeader(String name, String value)
setHeader in interface javax.servlet.http.HttpServletResponsesetHeader in class javax.servlet.http.HttpServletResponseWrappername - Name of the header to setvalue - Value to be setpublic void setIntHeader(String name, int value)
setIntHeader in interface javax.servlet.http.HttpServletResponsesetIntHeader in class javax.servlet.http.HttpServletResponseWrappername - Name of the header to setvalue - Integer value to be setpublic void addHeader(String name, String value)
addHeader in class javax.servlet.http.HttpServletResponseWrappername - Name of the header to setvalue - Value to be setpublic void addIntHeader(String name, int value)
addIntHeader in class javax.servlet.http.HttpServletResponseWrappername - Name of the header to setvalue - Integer value to be setpublic void setDateHeader(String name, long value)
setDateHeader in interface javax.servlet.http.HttpServletResponsesetDateHeader in class javax.servlet.http.HttpServletResponseWrappername - Name of the header to setvalue - Date value to be setpublic void addDateHeader(String name, long value)
addDateHeader in class javax.servlet.http.HttpServletResponseWrappername - Name of the header to setvalue - Date value to be setpublic void setStatus(int sc)
setStatus in interface javax.servlet.http.HttpServletResponsesetStatus in class javax.servlet.http.HttpServletResponseWrappersc - The new HTTP statuspublic void sendError(int status)
throws IOException
sendError in interface javax.servlet.http.HttpServletResponsesendError in class javax.servlet.http.HttpServletResponseWrapperstatus - HTTP status code to sendIllegalStateException - if this response has
already been committedIOException - if an input/output error occurspublic void sendError(int status,
String message)
throws IOException
sendError in interface javax.servlet.http.HttpServletResponsesendError in class javax.servlet.http.HttpServletResponseWrapperstatus - HTTP status code to sendmessage - Corresponding message to sendIllegalStateException - if this response has
already been committedIOException - if an input/output error occurspublic boolean isError()
public Long getExpiresDateHeader()
public HttpCacheEntry cacheResponse() throws IOException
IOExceptionpublic void clear()
Copyright © 2017. All rights reserved.