public class HttpResponseWrapper extends javax.servlet.http.HttpServletResponseWrapper implements HttpResponse
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 and Description |
|---|
HttpResponseWrapper(HttpResponse response,
javax.servlet.http.HttpServletResponse servletResponse) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionCookieInternal(javax.servlet.http.Cookie cookie)
Special method for adding a session cookie as we should be overriding
any previous
|
javax.servlet.ServletOutputStream |
createOutputStream()
Create and return a ServletOutputStream to write the content
associated with this Response.
|
String |
encode(String url)
Apply URL Encoding to the given URL without adding session identifier
et al associated to this response.
|
void |
finishResponse()
Perform whatever actions are required to flush and close the output
stream or writer, in a single operation.
|
Connector |
getConnector()
Return the Connector through which this Response is returned.
|
int |
getContentCount()
Return the number of bytes actually written to the output stream.
|
int |
getContentLength()
Return the content length that was set or calculated for this Response.
|
Context |
getContext()
Return the Context with which this Response is associated.
|
String |
getDetailMessage()
Gets detail error message.
|
String |
getHeader(String name)
Return the value for the specified header, or
null if this
header has not been set. |
Collection<String> |
getHeaderNames() |
Collection<String> |
getHeaders(String name) |
boolean |
getIncluded()
Return the "processing inside an include" flag.
|
String |
getInfo()
Return descriptive information about this Response implementation and
the corresponding version number, in the format
<description>/<version>. |
String |
getMessage()
Return the error message that was set with
sendError()
for this Response. |
PrintWriter |
getReporter()
Return a PrintWriter that can be used to render error messages,
regardless of whether a stream or writer has already been acquired.
|
Request |
getRequest()
Return the Request with which this Response is associated.
|
javax.servlet.ServletResponse |
getResponse()
Return the
ServletResponse for which this object
is the facade. |
int |
getStatus()
Return the HTTP status code associated with this Response.
|
OutputStream |
getStream()
Return the output stream associated with this Response.
|
boolean |
isAppCommitted()
Application commit flag accessor.
|
boolean |
isError()
Error flag accessor.
|
boolean |
isSuspended()
Suspended flag accessor.
|
void |
recycle()
Release all object references, and initialize instance variables, in
preparation for reuse of this object.
|
void |
reset(int status,
String message)
Reset this response, and specify the values for the HTTP status code
and corresponding message.
|
void |
resetBuffer(boolean resetWriterStreamFlags)
Reset the data buffer and the using Writer/Stream flags but not any
status or header information.
|
void |
sendAcknowledgement()
Send an acknowledgment of a request.
|
void |
setAppCommitted(boolean appCommitted)
Set the application commit flag.
|
void |
setConnector(Connector connector)
Set the Connector through which this Response is returned.
|
void |
setContext(Context context)
Set the Context with which this Response is associated.
|
void |
setDetailMessage(String message)
Sets detail error message.
|
void |
setError()
Set the error flag.
|
void |
setIncluded(boolean included)
Set the "processing inside an include" flag.
|
void |
setRequest(Request request)
Set the Request with which this Response is associated.
|
void |
setStream(OutputStream stream)
Set the output stream associated with this Response.
|
void |
setSuspended(boolean suspended)
Set the suspended flag.
|
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getTrailerFields, sendError, sendError, sendRedirect, setDateHeader, setHeader, setIntHeader, setStatus, setStatus, setTrailerFieldsflushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, isWrapperFor, isWrapperFor, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setContentType, setLocale, setResponseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContentType, resetBufferflushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setContentType, setLocalepublic HttpResponseWrapper(HttpResponse response, javax.servlet.http.HttpServletResponse servletResponse)
public String getHeader(String name)
HttpResponsenull if this
header has not been set. If more than one value was added for this
name, only the first is returned; use HttpResponse.getHeaders(String) to
retrieve all of them.getHeader in interface javax.servlet.http.HttpServletResponsegetHeader in interface HttpResponsegetHeader in class javax.servlet.http.HttpServletResponseWrappername - Header name to look uppublic Collection<String> getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletResponsegetHeaderNames in interface HttpResponsegetHeaderNames in class javax.servlet.http.HttpServletResponseWrapperCollection of the names
of the headers of this responsepublic Collection<String> getHeaders(String name)
getHeaders in interface javax.servlet.http.HttpServletResponsegetHeaders in interface HttpResponsegetHeaders in class javax.servlet.http.HttpServletResponseWrappername - the name of the response header whose values to returnCollection of the values
of the response header with the given namepublic void addSessionCookieInternal(javax.servlet.http.Cookie cookie)
HttpResponseaddSessionCookieInternal in interface HttpResponsepublic String getMessage()
HttpResponsesendError()
for this Response.getMessage in interface HttpResponsepublic int getStatus()
HttpResponsegetStatus in interface javax.servlet.http.HttpServletResponsegetStatus in interface HttpResponsegetStatus in class javax.servlet.http.HttpServletResponseWrapperpublic void reset(int status,
String message)
HttpResponsereset in interface HttpResponsepublic Connector getConnector()
ResponsegetConnector in interface Responsepublic void setConnector(Connector connector)
ResponsesetConnector in interface Responseconnector - The new connectorpublic int getContentCount()
ResponsegetContentCount in interface Responsepublic Context getContext()
ResponsegetContext in interface Responsepublic void setContext(Context context)
ResponsesetContext in interface Responsecontext - The associated Contextpublic void setAppCommitted(boolean appCommitted)
ResponsesetAppCommitted in interface ResponseappCommitted - The new application committed flag valuepublic boolean isAppCommitted()
ResponseisAppCommitted in interface Responsepublic boolean getIncluded()
ResponsegetIncluded in interface Responsepublic void setIncluded(boolean included)
ResponsesetIncluded in interface Responseincluded - true if we are currently inside a
RequestDispatcher.include(), else falsepublic String getInfo()
Response<description>/<version>.public Request getRequest()
ResponsegetRequest in interface Responsepublic void setRequest(Request request)
ResponsesetRequest in interface Responserequest - The new associated requestpublic javax.servlet.ServletResponse getResponse()
ResponseServletResponse for which this object
is the facade.getResponse in interface ResponsegetResponse in class javax.servlet.ServletResponseWrapperpublic OutputStream getStream()
Responsepublic void setStream(OutputStream stream)
Responsepublic void setSuspended(boolean suspended)
ResponsesetSuspended in interface Responsesuspended - The new suspended flag valuepublic boolean isSuspended()
ResponseisSuspended in interface Responsepublic void setError()
Responsepublic boolean isError()
Responsepublic void setDetailMessage(String message)
ResponsesetDetailMessage in interface Responsemessage - detail error messagepublic String getDetailMessage()
ResponsegetDetailMessage in interface Responsepublic javax.servlet.ServletOutputStream createOutputStream()
throws IOException
ResponsecreateOutputStream in interface ResponseIOException - if an input/output error occurspublic void finishResponse()
throws IOException
ResponsefinishResponse in interface ResponseIOException - if an input/output error occurspublic int getContentLength()
ResponsegetContentLength in interface Responsepublic PrintWriter getReporter() throws IOException
ResponsegetReporter in interface ResponseIOException - if an input/output error occurspublic void recycle()
Responsepublic void resetBuffer(boolean resetWriterStreamFlags)
ResponseresetBuffer in interface Responsepublic void sendAcknowledgement()
throws IOException
HttpResponseHTTP/1.1 [STATUS] [REASON-PHRASE].sendAcknowledgement in interface HttpResponsesendAcknowledgement in interface ResponseIOException - if an input/output error occursCopyright © 2019. All rights reserved.