|
|||||||||
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 response)
|
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. |
void |
flushBuffer()
|
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 |
---|
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 |
---|
getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, setCharacterEncoding, setLocale |
Constructor Detail |
---|
public ScopedResponseImpl(HttpServletResponse response)
Method Detail |
---|
public void sendError(int i, String s) throws IOException
sendError
in interface HttpServletResponse
sendError
in class HttpServletResponseWrapper
IOException
public void sendError(int i) throws IOException
sendError
in interface HttpServletResponse
sendError
in class HttpServletResponseWrapper
IOException
public void setStatus(int i)
setStatus
in interface HttpServletResponse
setStatus
in class HttpServletResponseWrapper
public void setStatus(int i, String s)
setStatus
in interface HttpServletResponse
setStatus
in class HttpServletResponseWrapper
public void setContentLength(int i)
setContentLength
in interface ServletResponse
setContentLength
in class ServletResponseWrapper
public void setContentType(String s)
setContentType
in interface ServletResponse
setContentType
in class ServletResponseWrapper
public void setBufferSize(int i)
setBufferSize
in interface ServletResponse
setBufferSize
in class ServletResponseWrapper
public void flushBuffer() throws IOException
flushBuffer
in interface ServletResponse
flushBuffer
in class ServletResponseWrapper
IOException
public void resetBuffer()
resetBuffer
in interface ServletResponse
resetBuffer
in class ServletResponseWrapper
public void reset()
reset
in interface ServletResponse
reset
in class ServletResponseWrapper
public void addCookie(Cookie cookie)
addCookie
in interface HttpServletResponse
addCookie
in class HttpServletResponseWrapper
public Cookie getCookie(String cookieName)
getCookie
in interface ScopedResponse
public Cookie[] getCookies()
getCookies
in interface ScopedResponse
public boolean containsHeader(String name)
true
if this response containes the given header.
containsHeader
in interface HttpServletResponse
containsHeader
in class HttpServletResponseWrapper
public void setDateHeader(String name, long date)
setDateHeader
in interface HttpServletResponse
setDateHeader
in class HttpServletResponseWrapper
public void addDateHeader(String name, long date)
addDateHeader
in interface HttpServletResponse
addDateHeader
in class HttpServletResponseWrapper
public void setHeader(String name, String value)
setHeader
in interface HttpServletResponse
setHeader
in class HttpServletResponseWrapper
public void addHeader(String name, String value)
addHeader
in interface HttpServletResponse
addHeader
in class HttpServletResponseWrapper
public void setIntHeader(String name, int value)
setIntHeader
in interface HttpServletResponse
setIntHeader
in class HttpServletResponseWrapper
public void addIntHeader(String name, int value)
addIntHeader
in interface HttpServletResponse
addIntHeader
in class HttpServletResponseWrapper
public Map getHeaders()
getHeaders
in interface ScopedResponse
public List getHeaders(String name)
getHeaders
in interface ScopedResponse
null
if none are found.public Object getFirstHeader(String name)
getFirstHeader
in interface ScopedResponse
null
if none is found.protected void addObjectHeader(String name, Object val)
protected void setObjectHeader(String name, Object val)
public HttpServletResponse getOuterResponse()
getOuterResponse
in interface ScopedResponse
public boolean isError()
ScopedResponse
isError
in interface ScopedResponse
true
if HttpServletResponse.sendError(int,String)
or HttpServletResponse.sendError(int)
was called.public int getStatusCode()
ScopedResponse
getStatusCode
in interface ScopedResponse
HttpServletResponse.setStatus(int)
, HttpServletResponse.sendError(int,String)
, or
HttpServletResponse.sendError(int)
; -1 if no status was set explicitly.public String getStatusMessage()
ScopedResponse
getStatusMessage
in interface ScopedResponse
HttpServletResponse.sendError(int,String)
, or null
if none was set.public void sendRedirect(String redirectURI) throws IOException
sendRedirect
in interface HttpServletResponse
sendRedirect
in class HttpServletResponseWrapper
IOException
public void applyRedirect() throws IOException
sendRedirect(java.lang.String)
.
applyRedirect
in interface ScopedResponse
IllegalStateException
- 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 ScopedResponse
true
if HttpServletResponse.sendRedirect(java.lang.String)
was called.public String getRedirectURI()
ScopedResponse
getRedirectURI
in interface ScopedResponse
HttpServletResponse.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 |