| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addCookie(Cookie
the Cookie to return to the client cookie)Implements jakarta. Adds the specified cookie to the response. |
| public void | addDateHeader(String
the name of the header to set name, long the additional date value date)Implements jakarta. Adds a response header with the given name and date-value. |
| public void | addHeader(String
the name of the header name, String the additional header value If it contains octet string, it should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt) value)Implements jakarta. Adds a response header with the given name and value. |
| public void | addIntHeader(String
the name of the header name, int the assigned integer value value)Implements jakarta. Adds a response header with the given name and integer value. |
| public boolean | containsHeader(String
the header name name)Implements jakarta. Returns a boolean indicating whether the named response header has already been set. |
| public String | encodeRedirectURL(String
the url to be encoded. url)Implements jakarta. Encodes the specified URL for use in the |
| public String | encodeURL(String
the url to be encoded. url)Implements jakarta. Encodes the specified URL by including the session ID, or, if encoding is not needed, returns the URL unchanged. |
| public String | getHeader(String
the name of the response header whose value to return name)Implements jakarta. Gets the value of the response header with the given name. |
| public Collection | getHeaderNames()
Implements jakarta. Gets the names of the headers of this response. |
| public Collection | getHeaders(String
the name of the response header whose values to return name)Implements jakarta. Gets the values of the response header with the given name. |
| public int | getStatus()
Implements jakarta. Gets the current status code of this response. |
| public void | sendError(int
the error status code sc, String the descriptive message msg)Implements jakarta. Sends an error response to the client using the specified status and clears the buffer. |
| public void | sendError(int
the error status code sc)Implements jakarta. Sends an error response to the client using the specified status code and clears the buffer. |
| public void | sendRedirect(String
the redirect location URL location)Implements jakarta. Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer. |
| public void | setDateHeader(String
the name of the header to set name, long the assigned date value date)Implements jakarta. Sets a response header with the given name and date-value. |
| public void | setHeader(String
the name of the header name, String the header value If it contains octet string, it should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt) value)Implements jakarta. Sets a response header with the given name and value. |
| public void | setIntHeader(String
the name of the header name, int the assigned integer value value)Implements jakarta. Sets a response header with the given name and integer value. |
| public void | setStatus(int
the status code sc)Implements jakarta. Sets the status code for this response. |
| ServletResponseHttpWrapper | back to summary |
|---|---|
| public ServletResponseHttpWrapper(ServletResponse response) | |
| addCookie | back to summary |
|---|---|
| public void addCookie(Cookie cookie) Implements jakarta. Doc from jakarta. Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie. | |
| addDateHeader | back to summary |
|---|---|
| public void addDateHeader(String name, long date) Implements jakarta. Doc from jakarta. Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. This method allows response headers to have multiple values. | |
| addHeader | back to summary |
|---|---|
| public void addHeader(String name, String value) Implements jakarta. Doc from jakarta. Adds a response header with the given name and value. This method allows response headers to have multiple values. | |
| addIntHeader | back to summary |
|---|---|
| public void addIntHeader(String name, int value) Implements jakarta. Doc from jakarta. Adds a response header with the given name and integer value. This method allows response headers to have multiple values. | |
| containsHeader | back to summary |
|---|---|
| public boolean containsHeader(String name) Implements jakarta. Doc from jakarta. Returns a boolean indicating whether the named response header has already been set. | |
| encodeRedirectURL | back to summary |
|---|---|
| public String encodeRedirectURL(String url) Implements jakarta. Doc from jakarta. Encodes the specified URL for use in the
All URLs sent to the If the URL is relative, it is always relative to the current HttpServletRequest. | |
| encodeURL | back to summary |
|---|---|
| public String encodeURL(String url) Implements jakarta. Doc from jakarta. Encodes the specified URL by including the session ID, or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary. For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies. If the URL is relative, it is always relative to the current HttpServletRequest. | |
| getHeader | back to summary |
|---|---|
| public String getHeader(String name) Implements jakarta. Doc from jakarta. Gets the value of the response header with the given name. If a response header with the given name exists and contains multiple values, the value that was added first will be returned.
This method considers only response headers set or added via | |
| getHeaderNames | back to summary |
|---|---|
| public Collection Implements jakarta. Doc from jakarta. Gets the names of the headers of this response.
This method considers only response headers set or added via
Any changes to the returned
| |
| getHeaders | back to summary |
|---|---|
| public Collection Implements jakarta. Doc from jakarta. Gets the values of the response header with the given name.
This method considers only response headers set or added via
Any changes to the returned
| |
| getStatus | back to summary |
|---|---|
| public int getStatus() Implements jakarta. Doc from jakarta. Gets the current status code of this response.
| |
| sendError | back to summary |
|---|---|
| public void sendError(int sc, String msg) throws IOException Implements jakarta. Doc from jakarta. Sends an error response to the client using the specified status and clears the buffer. The server defaults to creating the response to look like an HTML-formatted server error page containing the specified message, setting the content type to "text/html". The caller is not responsible for escaping or re-encoding the message to ensure it is safe with respect to the current response encoding and content type. This aspect of safety is the responsibility of the container, as it is generating the error page containing the message. The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid response. If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back in preference to the suggested msg parameter and the msg parameter will be ignored. If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
| |
| sendError | back to summary |
|---|---|
| public void sendError(int sc) throws IOException Implements jakarta. Doc from jakarta. Sends an error response to the client using the specified status code and clears the buffer. The server will preserve cookies and may clear or update any headers needed to serve the error page as a valid response. If an error-page declaration has been made for the web application corresponding to the status code passed in, it will be served back the error page If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
| |
| sendRedirect | back to summary |
|---|---|
| public void sendRedirect(String location) throws IOException Implements jakarta. Doc from jakarta. Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.
The buffer will be replaced with the data set by this method. Calling this method sets the status code to
If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
| |
| setDateHeader | back to summary |
|---|---|
| public void setDateHeader(String name, long date) Implements jakarta. Doc from jakarta. Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the
epoch. If the header had already been set, the new value overwrites the previous one. The | |
| setHeader | back to summary |
|---|---|
| public void setHeader(String name, String value) Implements jakarta. Doc from jakarta. Sets a response header with the given name and value. If the header had already been set, the new value overwrites
the previous one. The | |
| setIntHeader | back to summary |
|---|---|
| public void setIntHeader(String name, int value) Implements jakarta. Doc from jakarta. Sets a response header with the given name and integer value. If the header had already been set, the new value
overwrites the previous one. The | |
| setStatus | back to summary |
|---|---|
| public void setStatus(int sc) Implements jakarta. Doc from jakarta. Sets the status code for this response. This method is used to set the return status code when there is no error (for example, for the SC_OK or SC_MOVED_TEMPORARILY status codes).
If this method is used to set an error code, then the container's error page mechanism will not be triggered. If
there is an error and the caller wishes to invoke an error page defined in the web application, then
This method preserves any cookies and other response headers. Valid status codes are those in the 2XX, 3XX, 4XX, and 5XX ranges. Other status codes are treated as container specific.
| |