| java.lang.Object org.apache.catalina.connector.ResponseBase org.apache.catalina.connector.HttpResponseBase
All known Subclasses: org.apache.catalina.connector.http.HttpResponseImpl, org.apache.catalina.connector.http10.HttpResponseImpl,
HttpResponseBase | public class HttpResponseBase extends ResponseBase implements HttpResponse,HttpServletResponse(Code) | | Convenience base implementation of the HttpResponse interface, which
can be used for the Response implementation required by most
Connectors that deal with HTTP. Only the connector-specific
methods need to be implemented.
author: Craig R. McClanahan author: Remy Maucherat version: $Revision: 1.54 $ $Date: 2002/04/05 18:43:12 $ |
Field Summary | |
protected ArrayList | cookies The set of Cookies associated with this Response. | protected HttpResponseFacade | facade The facade associated with this response. | final protected SimpleDateFormat | format The date format we will use for creating date headers. | protected HashMap | headers The HTTP headers explicitly added via addHeader(), but not including
those to be added with setContentLength(), setContentType(), and so on. | final protected static String | info Descriptive information about this HttpResponse implementation. | protected String | message The error message set by sendError() . | protected int | status The HTTP status code associated with this Response. | final protected static TimeZone | zone The time zone with which to construct date headers. |
Method Summary | |
public void | addCookie(Cookie cookie) Add the specified Cookie to those that will be included with
this Response. | public void | addDateHeader(String name, long value) Add the specified date header to the specified value. | public void | addHeader(String name, String value) Add the specified header to the specified value. | public void | addIntHeader(String name, int value) Add the specified integer header to the specified value. | public boolean | containsHeader(String name) | public String | encodeRedirectURL(String url) Encode the session identifier associated with this response
into the specified redirect URL, if necessary. | public String | encodeRedirectUrl(String url) Encode the session identifier associated with this response
into the specified redirect URL, if necessary. | public String | encodeURL(String url) Encode the session identifier associated with this response
into the specified URL, if necessary. | public String | encodeUrl(String url) Encode the session identifier associated with this response
into the specified URL, if necessary. | public void | finishResponse() Perform whatever actions are required to flush and close the output
stream or writer, in a single operation. | public void | flushBuffer() Flush the buffer and commit this response. | public Cookie[] | getCookies() Return an array of all cookies set for this response, or
a zero-length array if no cookies have been set. | public String | getHeader(String name) Return the value for the specified header, or null if this
header has not been set. | public String[] | getHeaderNames() Return an array of all the header names set for this response, or
a zero-length array if no headers have been set. | public String[] | getHeaderValues(String name) Return an array of all the header values associated with the
specified header name, or an zero-length array if there are no such
header values. | public String | getMessage() Return the error message that was set with sendError()
for this Response. | protected String | getProtocol() Return the HTTP protocol version implemented by this response
object. | public ServletResponse | getResponse() Return the ServletResponse for which this object
is the facade. | public int | getStatus() Return the HTTP status code associated with this Response. | protected String | getStatusMessage(int status) Returns a default status message for the specified HTTP status code. | public void | recycle() Release all object references, and initialize instance variables, in
preparation for reuse of this object. | public void | reset(int status, String message) Reset this response, and specify the values for the HTTP status code
and corresponding message. | public void | reset() Clear any content written to the buffer. | public void | sendAcknowledgement() Send an acknowledgment of a request. | public void | sendError(int status) Send an error response with the specified status and a
default message. | public void | sendError(int status, String message) Send an error response with the specified status and message. | protected void | sendHeaders() Send the HTTP response headers, if this has not already occurred. | public void | sendRedirect(String location) Send a temporary redirect to the specified redirect location URL. | public void | setContentLength(int length) Set the content length (in bytes) for this Response. | public void | setContentType(String type) Set the content type for this Response. | public void | setDateHeader(String name, long value) Set the specified date header to the specified value. | public void | setHeader(String name, String value) Set the specified header to the specified value. | public void | setIntHeader(String name, int value) Set the specified integer header to the specified value. | public void | setLocale(Locale locale) Set the Locale that is appropriate for this response, including
setting the appropriate character encoding. | public void | setStatus(int status) Set the HTTP status to be returned with this response. | public void | setStatus(int status, String message) Set the HTTP status and message to be returned with this response. |
cookies | protected ArrayList cookies(Code) | | The set of Cookies associated with this Response.
|
headers | protected HashMap headers(Code) | | The HTTP headers explicitly added via addHeader(), but not including
those to be added with setContentLength(), setContentType(), and so on.
This collection is keyed by the header name, and the elements are
ArrayLists containing the associated values that have been set.
|
info | final protected static String info(Code) | | Descriptive information about this HttpResponse implementation.
|
message | protected String message(Code) | | The error message set by sendError() .
|
status | protected int status(Code) | | The HTTP status code associated with this Response.
|
zone | final protected static TimeZone zone(Code) | | The time zone with which to construct date headers.
|
HttpResponseBase | public HttpResponseBase()(Code) | | |
addCookie | public void addCookie(Cookie cookie)(Code) | | Add the specified Cookie to those that will be included with
this Response.
Parameters: cookie - Cookie to be added |
addDateHeader | public void addDateHeader(String name, long value)(Code) | | Add the specified date header to the specified value.
Parameters: name - Name of the header to set Parameters: value - Date value to be set |
addHeader | public void addHeader(String name, String value)(Code) | | Add the specified header to the specified value.
Parameters: name - Name of the header to set Parameters: value - Value to be set |
addIntHeader | public void addIntHeader(String name, int value)(Code) | | Add the specified integer header to the specified value.
Parameters: name - Name of the header to set Parameters: value - Integer value to be set |
containsHeader | public boolean containsHeader(String name)(Code) | | Has the specified header been set already in this response?
Parameters: name - Name of the header to check |
encodeRedirectURL | public String encodeRedirectURL(String url)(Code) | | Encode the session identifier associated with this response
into the specified redirect URL, if necessary.
Parameters: url - URL to be encoded |
encodeRedirectUrl | public String encodeRedirectUrl(String url)(Code) | | Encode the session identifier associated with this response
into the specified redirect URL, if necessary.
Parameters: url - URL to be encoded |
encodeURL | public String encodeURL(String url)(Code) | | Encode the session identifier associated with this response
into the specified URL, if necessary.
Parameters: url - URL to be encoded |
encodeUrl | public String encodeUrl(String url)(Code) | | Encode the session identifier associated with this response
into the specified URL, if necessary.
Parameters: url - URL to be encoded |
finishResponse | public void finishResponse() throws IOException(Code) | | Perform whatever actions are required to flush and close the output
stream or writer, in a single operation.
exception: IOException - if an input/output error occurs |
flushBuffer | public void flushBuffer() throws IOException(Code) | | Flush the buffer and commit this response. If this is the first output,
send the HTTP headers prior to the user data.
exception: IOException - if an input/output error occurs |
getCookies | public Cookie[] getCookies()(Code) | | Return an array of all cookies set for this response, or
a zero-length array if no cookies have been set.
|
getHeader | public String getHeader(String name)(Code) | | Return the value for the specified header, or null if this
header has not been set. If more than one value was added for this
name, only the first is returned; use getHeaderValues() to retrieve all
of them.
Parameters: name - Header name to look up |
getHeaderNames | public String[] getHeaderNames()(Code) | | Return an array of all the header names set for this response, or
a zero-length array if no headers have been set.
|
getHeaderValues | public String[] getHeaderValues(String name)(Code) | | Return an array of all the header values associated with the
specified header name, or an zero-length array if there are no such
header values.
Parameters: name - Header name to look up |
getMessage | public String getMessage()(Code) | | Return the error message that was set with sendError()
for this Response.
|
getProtocol | protected String getProtocol()(Code) | | Return the HTTP protocol version implemented by this response
object. (This method must be overridden by subclasses of this
as to correctly return the highest HTTP version number supported
as specified in Section 3.1 of RFC-2616).
A string in the form of "HTTP/1.0" ... |
getResponse | public ServletResponse getResponse()(Code) | | Return the ServletResponse for which this object
is the facade.
|
getStatus | public int getStatus()(Code) | | Return the HTTP status code associated with this Response.
|
getStatusMessage | protected String getStatusMessage(int status)(Code) | | Returns a default status message for the specified HTTP status code.
Parameters: status - The status code for which a message is desired |
recycle | public void recycle()(Code) | | Release all object references, and initialize instance variables, in
preparation for reuse of this object.
|
reset | public void reset(int status, String message)(Code) | | Reset this response, and specify the values for the HTTP status code
and corresponding message.
exception: IllegalStateException - if this response has already beencommitted |
reset | public void reset()(Code) | | Clear any content written to the buffer. In addition, all cookies
and headers are cleared, and the status is reset.
exception: IllegalStateException - if this response has alreadybeen committed |
sendAcknowledgement | public void sendAcknowledgement() throws IOException(Code) | | Send an acknowledgment of a request.
exception: IOException - if an input/output error occurs |
sendError | public void sendError(int status) throws IOException(Code) | | Send an error response with the specified status and a
default message.
Parameters: status - HTTP status code to send exception: IllegalStateException - if this response hasalready been committed exception: IOException - if an input/output error occurs |
sendError | public void sendError(int status, String message) throws IOException(Code) | | Send an error response with the specified status and message.
Parameters: status - HTTP status code to send Parameters: message - Corresponding message to send exception: IllegalStateException - if this response hasalready been committed exception: IOException - if an input/output error occurs |
sendHeaders | protected void sendHeaders() throws IOException(Code) | | Send the HTTP response headers, if this has not already occurred.
|
sendRedirect | public void sendRedirect(String location) throws IOException(Code) | | Send a temporary redirect to the specified redirect location URL.
Parameters: location - Location URL to redirect to exception: IllegalStateException - if this response hasalready been committed exception: IOException - if an input/output error occurs |
setContentLength | public void setContentLength(int length)(Code) | | Set the content length (in bytes) for this Response.
Parameters: length - The new content length |
setContentType | public void setContentType(String type)(Code) | | Set the content type for this Response.
Parameters: type - The new content type |
setDateHeader | public void setDateHeader(String name, long value)(Code) | | Set the specified date header to the specified value.
Parameters: name - Name of the header to set Parameters: value - Date value to be set |
setHeader | public void setHeader(String name, String value)(Code) | | Set the specified header to the specified value.
Parameters: name - Name of the header to set Parameters: value - Value to be set |
setIntHeader | public void setIntHeader(String name, int value)(Code) | | Set the specified integer header to the specified value.
Parameters: name - Name of the header to set Parameters: value - Integer value to be set |
setLocale | public void setLocale(Locale locale)(Code) | | Set the Locale that is appropriate for this response, including
setting the appropriate character encoding.
Parameters: locale - The new locale |
setStatus | public void setStatus(int status)(Code) | | Set the HTTP status to be returned with this response.
Parameters: status - The new HTTP status |
setStatus | public void setStatus(int status, String message)(Code) | | Set the HTTP status and message to be returned with this response.
Parameters: status - The new HTTP status Parameters: message - The associated text message |
|
|