public class DummyResponse extends Object implements HttpResponse, javax.servlet.http.HttpServletResponse
SC_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 |
|---|
DummyResponse() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCookie(javax.servlet.http.Cookie cookie) |
void |
addDateHeader(String name,
long value) |
void |
addHeader(String name,
String value) |
void |
addIntHeader(String name,
int value) |
void |
addSessionCookieInternal(javax.servlet.http.Cookie cookie)
Special method for adding a session cookie as we should be overriding
any previous
|
boolean |
containsHeader(String name) |
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.
|
String |
encodeRedirectUrl(String url) |
String |
encodeRedirectURL(String url) |
String |
encodeUrl(String url) |
String |
encodeURL(String url) |
void |
finishResponse()
Perform whatever actions are required to flush and close the output
stream or writer, in a single operation.
|
void |
flushBuffer() |
int |
getBufferSize() |
String |
getCharacterEncoding() |
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.
|
String |
getContentType()
Return the content type that was set or calculated for this response,
or
null if no content type was set. |
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>. |
Locale |
getLocale() |
String |
getMessage()
Return the error message that was set with
sendError()
for this Response. |
javax.servlet.ServletOutputStream |
getOutputStream() |
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.
|
PrintWriter |
getWriter() |
boolean |
isAppCommitted()
Application commit flag accessor.
|
boolean |
isCommitted() |
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() |
void |
reset(int status,
String message)
Reset this response, and specify the values for the HTTP status code
and corresponding message.
|
void |
resetBuffer()
Reset the data buffer but not any status or header information.
|
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 |
sendError(int status) |
void |
sendError(int status,
String message) |
void |
sendRedirect(String location) |
void |
setAppCommitted(boolean appCommitted)
Set the application commit flag.
|
void |
setBufferSize(int size) |
void |
setCharacterEncoding(String charEncoding) |
void |
setConnector(Connector connector)
Set the Connector through which this Response is returned.
|
void |
setContentLength(int length) |
void |
setContentLengthLong(long length) |
void |
setContentType(String type) |
void |
setContext(Context context)
Set the Context with which this Response is associated.
|
void |
setDateHeader(String name,
long value) |
void |
setDetailMessage(String msg)
Sets detail error message.
|
void |
setError()
Set the error flag.
|
void |
setHeader(String name,
String value) |
void |
setIncluded(boolean included)
Set the "processing inside an include" flag.
|
void |
setIntHeader(String name,
int value) |
void |
setLocale(Locale locale) |
void |
setRequest(Request request)
Set the Request with which this Response is associated.
|
void |
setStatus(int status) |
void |
setStatus(int status,
String message) |
void |
setStream(OutputStream stream)
Set the output stream associated with this Response.
|
void |
setSuspended(boolean suspended)
Set the suspended flag.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public void setAppCommitted(boolean appCommitted)
ResponsesetAppCommitted in interface ResponseappCommitted - The new application committed flag valuepublic boolean isAppCommitted()
ResponseisAppCommitted in interface Responsepublic 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 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 Responsepublic 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 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 String getContentType()
Responsenull if no content type was set.getContentType in interface Responsepublic PrintWriter getReporter()
ResponsegetReporter in interface Responsepublic void recycle()
Responsepublic void write(int b)
throws IOException
IOExceptionpublic void write(byte[] b)
throws IOException
IOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
IOExceptionpublic void flushBuffer()
throws IOException
IOExceptionpublic int getBufferSize()
public String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletResponsepublic void setCharacterEncoding(String charEncoding)
public javax.servlet.ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface javax.servlet.ServletResponseIOExceptionpublic Locale getLocale()
public PrintWriter getWriter() throws IOException
getWriter in interface javax.servlet.ServletResponseIOExceptionpublic boolean isCommitted()
public void reset()
public void resetBuffer()
ResponseresetBuffer in interface Responsepublic void resetBuffer(boolean resetWriterStreamFlags)
ResponseresetBuffer in interface Responsepublic void setBufferSize(int size)
public void setContentLength(int length)
setContentLength in interface javax.servlet.ServletResponsepublic void setContentLengthLong(long length)
public void setContentType(String type)
setContentType in interface javax.servlet.ServletResponsepublic void setLocale(Locale locale)
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 HttpResponsename - Header name to look uppublic Collection<String> getHeaderNames()
getHeaderNames in interface HttpResponseCollection of the names
of the headers of this responsepublic Collection<String> getHeaders(String name)
getHeaders in interface HttpResponsename - 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 HttpResponsepublic void reset(int status,
String message)
HttpResponsereset in interface HttpResponsepublic void addCookie(javax.servlet.http.Cookie cookie)
addCookie in interface javax.servlet.http.HttpServletResponsepublic void addDateHeader(String name, long value)
public void addIntHeader(String name, int value)
public boolean containsHeader(String name)
containsHeader in interface javax.servlet.http.HttpServletResponsepublic String encodeRedirectURL(String url)
encodeRedirectURL in interface javax.servlet.http.HttpServletResponsepublic String encodeRedirectUrl(String url)
encodeRedirectUrl in interface javax.servlet.http.HttpServletResponsepublic String encodeURL(String url)
encodeURL in interface javax.servlet.http.HttpServletResponsepublic String encodeUrl(String url)
encodeUrl in interface javax.servlet.http.HttpServletResponsepublic String encode(String url)
Responsepublic void sendAcknowledgement()
throws IOException
HttpResponseHTTP/1.1 [STATUS] [REASON-PHRASE].sendAcknowledgement in interface HttpResponsesendAcknowledgement in interface ResponseIOException - if an input/output error occurspublic void sendError(int status)
throws IOException
sendError in interface javax.servlet.http.HttpServletResponseIOExceptionpublic void sendError(int status,
String message)
throws IOException
sendError in interface javax.servlet.http.HttpServletResponseIOExceptionpublic void sendRedirect(String location) throws IOException
sendRedirect in interface javax.servlet.http.HttpServletResponseIOExceptionpublic void setDateHeader(String name, long value)
setDateHeader in interface javax.servlet.http.HttpServletResponsepublic void setHeader(String name, String value)
setHeader in interface javax.servlet.http.HttpServletResponsepublic void setIntHeader(String name, int value)
setIntHeader in interface javax.servlet.http.HttpServletResponsepublic void setStatus(int status)
setStatus in interface javax.servlet.http.HttpServletResponsepublic void setStatus(int status,
String message)
setStatus in interface javax.servlet.http.HttpServletResponsepublic void setDetailMessage(String msg)
ResponsesetDetailMessage in interface Responsemsg - detail error messagepublic String getDetailMessage()
ResponsegetDetailMessage in interface ResponseCopyright © 2017. All rights reserved.