ScopedResponse Interface
- public interface ScopedResponse
extends HttpServletResponse
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.
-
All Superinterfaces
-
HttpServletResponse
, ServletResponse
Fields from interface javax.servlet.http.HttpServletResponse |
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, 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_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 |
Methods from interface javax.servlet.http.HttpServletResponse |
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendError, sendError, sendRedirect, setDateHeader, setHeader, setIntHeader, setStatus, setStatus |
Methods from interface javax.servlet.ServletResponse |
flushBuffer, getBufferSize, getCharacterEncoding, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setContentLength, setContentType, setLocale |
applyRedirect() Method
public void applyRedirect()
throws IOException
Actually send the redirect that was suggested by ScopedResponse.sendRedirect(String)
.
Exceptions
-
IOException
- if
HttpServletResponse.sendRedirect(String)
causes an IOException.
didRedirect() Method
public boolean didRedirect()
Tell whether a browser redirect was sent.
Returns
true
if ScopedResponse.sendRedirect(String)
was called.
getCookie(String) Method
public Cookie
getCookie(String
cookieName)
Get a cookie that was added to the response.
getCookies() Method
public Cookie
[] getCookies()
Get all Cookies that were added to the response.
getFirstHeader(String) Method
public Object
getFirstHeader(String
name)
Get the first header with the given name.
Returns
- an Object (String, Integer, Date) that is the first header with the given name,
or
null
if none is found.
getHeaders() Method
public Map
getHeaders()
Get all headers.
Returns
- a Map of header-name (String) -> headers (List).
getHeaders(String) Method
public List
getHeaders(String
name)
Get all headers with the given name.
Returns
- a List of headers (String, Integer, Date), or
null
if none are found.
getOuterResponse() Method
public HttpServletResponse
getOuterResponse()
getRedirectURI() Method
public String
getRedirectURI()
Get the redirect URI.
Returns
- the URI passed to
ScopedResponse.sendRedirect(String)
, or null
if there was no redirect.
getStatusCode() Method
public int getStatusCode()
Get the status code on the response.
Returns
- the status code, set by
ScopedResponse.setStatus(int)
, ScopedResponse.sendError(int, String)
, or
ScopedResponse.sendError(int)
; -1 if no status was set explicitly.
getStatusMessage() Method
public String
getStatusMessage()
Get the status message on the response.
Returns
- the status code, set by
ScopedResponse.sendError(int, String)
, or null
if none was set.
isError() Method
public boolean isError()
Tell whether the response is in error.
Returns
true
if ScopedResponse.sendError(int, String)
or ScopedResponse.sendError(int)
was called.