|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectServletResponseWrapper
HttpServletResponseWrapper
ScopedResponseImpl
public class ScopedResponseImpl
A wrapper around HttpServletResponse, associated with a given scope-key. Delegates to the wrapped response object for some functionality, but prevents output or error codes or forwards from actually happening.
| Field Summary |
|---|
| Fields inherited from interface HttpServletResponse |
|---|
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, 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_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
| Constructor Summary | |
|---|---|
ScopedResponseImpl(HttpServletResponse servletResponse)
|
|
| Method Summary | |
|---|---|
void |
addCookie(Cookie cookie)
Add a cookie to the response. |
void |
addDateHeader(String name,
long date)
Adds a response header with the given name and date-value. |
void |
addHeader(String name,
String value)
Adds a response header with the given name and value. |
void |
addIntHeader(String name,
int value)
Adds a response header with the given name and integer value. |
protected void |
addObjectHeader(String name,
Object val)
|
void |
applyRedirect()
Actually send the redirect that was suggested by sendRedirect(java.lang.String). |
boolean |
containsHeader(String name)
Returns true if this response containes the given header. |
boolean |
didRedirect()
Tell whether a browser redirect was sent. |
Cookie |
getCookie(String cookieName)
Gets a cookie that was added to the response. |
Cookie[] |
getCookies()
Gets all Cookies that were added to the response. |
Object |
getFirstHeader(String name)
Gets the first header with the given name. |
Map |
getHeaders()
Gets all headers. |
List |
getHeaders(String name)
Gets all headers with the given name. |
HttpServletResponse |
getOuterResponse()
|
String |
getRedirectURI()
Get the redirect URI. |
int |
getStatusCode()
Get the status code on the response. |
String |
getStatusMessage()
Get the status message on the response. |
boolean |
isError()
Tell whether the response is in error. |
void |
reset()
|
void |
resetBuffer()
|
void |
sendError(int i)
|
void |
sendError(int i,
String s)
|
void |
sendRedirect(String redirectURI)
|
void |
setBufferSize(int i)
|
void |
setContentLength(int i)
|
void |
setContentType(String s)
|
void |
setDateHeader(String name,
long date)
Sets a response header with the given name and date-value. |
void |
setHeader(String name,
String value)
Sets a response header with the given name and value. |
void |
setIntHeader(String name,
int value)
Sets a response header with the given name and integer value. |
protected void |
setObjectHeader(String name,
Object val)
|
void |
setStatus(int i)
|
void |
setStatus(int i,
String s)
|
| Methods inherited from class HttpServletResponseWrapper |
|---|
encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL |
| Methods inherited from class ServletResponseWrapper |
|---|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getResponse, getWriter, isCommitted, setCharacterEncoding, setLocale, setResponse |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface HttpServletResponse |
|---|
encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL |
| Methods inherited from interface ServletResponse |
|---|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, setCharacterEncoding, setLocale |
| Constructor Detail |
|---|
public ScopedResponseImpl(HttpServletResponse servletResponse)
| Method Detail |
|---|
public void sendError(int i,
String s)
throws IOException
sendError in interface HttpServletResponsesendError in class HttpServletResponseWrapperIOException
public void sendError(int i)
throws IOException
sendError in interface HttpServletResponsesendError in class HttpServletResponseWrapperIOExceptionpublic void setStatus(int i)
setStatus in interface HttpServletResponsesetStatus in class HttpServletResponseWrapper
public void setStatus(int i,
String s)
setStatus in interface HttpServletResponsesetStatus in class HttpServletResponseWrapperpublic void setContentLength(int i)
setContentLength in interface ServletResponsesetContentLength in class ServletResponseWrapperpublic void setContentType(String s)
setContentType in interface ServletResponsesetContentType in class ServletResponseWrapperpublic void setBufferSize(int i)
setBufferSize in interface ServletResponsesetBufferSize in class ServletResponseWrapperpublic void resetBuffer()
resetBuffer in interface ServletResponseresetBuffer in class ServletResponseWrapperpublic void reset()
reset in interface ServletResponsereset in class ServletResponseWrapperpublic void addCookie(Cookie cookie)
addCookie in interface HttpServletResponseaddCookie in class HttpServletResponseWrapperpublic Cookie getCookie(String cookieName)
getCookie in interface ScopedResponsepublic Cookie[] getCookies()
getCookies in interface ScopedResponsepublic boolean containsHeader(String name)
true if this response containes the given header.
containsHeader in interface HttpServletResponsecontainsHeader in class HttpServletResponseWrapper
public void setDateHeader(String name,
long date)
setDateHeader in interface HttpServletResponsesetDateHeader in class HttpServletResponseWrapper
public void addDateHeader(String name,
long date)
addDateHeader in interface HttpServletResponseaddDateHeader in class HttpServletResponseWrapper
public void setHeader(String name,
String value)
setHeader in interface HttpServletResponsesetHeader in class HttpServletResponseWrapper
public void addHeader(String name,
String value)
addHeader in interface HttpServletResponseaddHeader in class HttpServletResponseWrapper
public void setIntHeader(String name,
int value)
setIntHeader in interface HttpServletResponsesetIntHeader in class HttpServletResponseWrapper
public void addIntHeader(String name,
int value)
addIntHeader in interface HttpServletResponseaddIntHeader in class HttpServletResponseWrapperpublic Map getHeaders()
getHeaders in interface ScopedResponsepublic List getHeaders(String name)
getHeaders in interface ScopedResponsenull if none are found.public Object getFirstHeader(String name)
getFirstHeader in interface ScopedResponsenull if none is found.
protected void addObjectHeader(String name,
Object val)
protected void setObjectHeader(String name,
Object val)
public HttpServletResponse getOuterResponse()
getOuterResponse in interface ScopedResponsepublic boolean isError()
ScopedResponse
isError in interface ScopedResponsetrue if HttpServletResponse.sendError(int,String) or HttpServletResponse.sendError(int) was called.public int getStatusCode()
ScopedResponse
getStatusCode in interface ScopedResponseHttpServletResponse.setStatus(int), HttpServletResponse.sendError(int,String), or
HttpServletResponse.sendError(int); -1 if no status was set explicitly.public String getStatusMessage()
ScopedResponse
getStatusMessage in interface ScopedResponseHttpServletResponse.sendError(int,String), or null if none was set.
public void sendRedirect(String redirectURI)
throws IOException
sendRedirect in interface HttpServletResponsesendRedirect in class HttpServletResponseWrapperIOException
public void applyRedirect()
throws IOException
sendRedirect(java.lang.String).
applyRedirect in interface ScopedResponseIllegalStateException - if sendRedirect(java.lang.String) was not called.
IOException - if HttpServletResponse.sendRedirect(java.lang.String) causes an IOException.public boolean didRedirect()
ScopedResponse
didRedirect in interface ScopedResponsetrue if HttpServletResponse.sendRedirect(java.lang.String) was called.public String getRedirectURI()
ScopedResponse
getRedirectURI in interface ScopedResponseHttpServletResponse.sendRedirect(java.lang.String), or null if there was no redirect.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||