public class ServletWebResponse extends java.lang.Object implements WebResponse
HttpServletResponse as
WebResponse.| Constructor and Description |
|---|
ServletWebResponse(javax.servlet.http.HttpServletResponse response) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
encodeURL(java.lang.String url)
Encodes a URL, which adds information to the URL needed to ensure that the request triggered
by the URL will be associated with the current session (if any).
|
java.lang.String |
getNamespace()
Returns a value to be prefixed or suffixed with any client-side JavaScript elements
(variables and function names) to ensure that they are unique with the context of the entire
page.
|
java.io.OutputStream |
getOutputStream(ContentType contentType)
Returns a output stream to which output should be sent.
|
java.io.PrintWriter |
getPrintWriter(ContentType contentType)
Returns a
PrintWriter to which output should be sent. |
void |
reset()
Resets any buffered content.
|
void |
sendError(int statusCode,
java.lang.String message)
Sends an error response.
|
void |
setContentLength(int length) |
void |
setDateHeader(java.lang.String name,
long date)
Sets a response header as a date.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets a response header as a string.
|
void |
setIntHeader(java.lang.String name,
int value)
Sets a response header with the given name and integer value.
|
void |
setStatus(int status)
Sets the status code for this response.
|
public ServletWebResponse(javax.servlet.http.HttpServletResponse response)
public java.io.OutputStream getOutputStream(ContentType contentType)
WebResponsegetOutputStream in interface WebResponsepublic java.io.PrintWriter getPrintWriter(ContentType contentType) throws java.io.IOException
WebResponsePrintWriter to which output should be sent. This method should be invoked
once on a response. A second call is expected to be so that an exception page can be
rendered, and the underlying request data is reset.getPrintWriter in interface WebResponsejava.io.IOExceptionpublic java.lang.String encodeURL(java.lang.String url)
WebResponseencodeURL in interface WebResponsepublic void reset()
WebResponsereset in interface WebResponsepublic void setContentLength(int length)
setContentLength in interface WebResponsepublic java.lang.String getNamespace()
WebResponsegetNamespace in interface WebResponsepublic void setDateHeader(java.lang.String name, long date)
WebResponsesetDateHeader in interface WebResponsename - the name of the header to setdate - the date value to set, in milliseconds since the epochpublic void setStatus(int status)
WebResponsesetStatus in interface WebResponsepublic void setHeader(java.lang.String name, java.lang.String value)
WebResponsesetHeader in interface WebResponsename - the name of the header to setvalue - the value for the named headerpublic void setIntHeader(java.lang.String name, int value)
WebResponsesetIntHeader in interface WebResponsename - the name of the header to setvalue - the value for the named headerpublic void sendError(int statusCode, java.lang.String message) throws java.io.IOException
WebResponsesendError in interface WebResponsejava.io.IOException