Located in compilation unit of javax.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private NoBodyOutputStream | |
| private HttpServletResponse | |
| private PrintWriter |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | addCookie(Cookie
the Cookie to return to the client cookie)Implements javax. |
| public void | addDateHeader(String
the name of the header to set name, long the additional date value value)Implements javax. |
| 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 javax. |
| public void | addIntHeader(String
the name of the header name, int the assigned integer value value)Implements javax. |
| public boolean | containsHeader(String
the header name name)Implements javax. |
| public String | encodeRedirectURL(String
the url to be encoded. url)Implements javax. sendRedirect method or, if encoding is not needed,
returns the URL unchanged.
|
| public String | encodeRedirectUrl(String
the url to be encoded. url)Implements javax.
Deprecated
As of Version 2.1, replaced by
HttpServletResponse#encodeRedirectURL.
|
| public String | encodeURL(String
the url to be encoded. url)Implements javax. |
| public String | encodeUrl(String
the url to be encoded. url)Implements javax.
Deprecated
As of Version 2.1, replaced by
HttpServletResponse#encodeURL.
|
| public void | flushBuffer()
Implements javax. |
| public int | getBufferSize()
Implements javax. |
| public String | getCharacterEncoding()
Implements javax. |
| public String | getContentType()
Implements javax. |
| public Locale | getLocale()
Implements javax. setLocale method.
|
| public ServletOutputStream | getOutputStream()
Implements javax. ServletOutputStream suitable for writing binary
data in the response.
|
| public PrintWriter | getWriter()
Implements javax. PrintWriter object that
can send character text to the client.
|
| public boolean | isCommitted()
Implements javax. |
| public void | reset()
Implements javax. |
| public void | resetBuffer()
Implements javax. |
| public void | sendError(int
the error status code sc, String the descriptive message msg)Implements javax. |
| public void | sendError(int
the error status code sc)Implements javax. |
| public void | sendRedirect(String
the redirect location URL location)Implements javax. |
| public void | setBufferSize(int
the preferred buffer size size)Implements javax. |
| public void | setCharacterEncoding(String
a String specifying only the character set
defined by IANA Character Sets
(http://www.iana.org/assignments/character-sets) charset)Implements javax. |
| pack-priv void | |
| public void | setContentLength(int
an integer specifying the length of the
content being returned to the client; sets
the Content-Length header len)Implements javax. |
| public void | setContentType(String
a type)String specifying the MIME
type of the contentImplements javax. |
| public void | setDateHeader(String
the name of the header to set name, long the assigned date value date)Implements javax. |
| 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 javax. |
| public void | setIntHeader(String
the name of the header name, int the assigned integer value value)Implements javax. |
| public void | setLocale(Locale
the locale of the response loc)Implements javax. |
| public void | setStatus(int
the status code sc, String the status message sm)Implements javax.
Deprecated
|
| public void | setStatus(int
the status code sc)Implements javax. |
| didSetContentLength | back to summary |
|---|---|
| private boolean didSetContentLength | |
| noBody | back to summary |
|---|---|
| private NoBodyOutputStream noBody | |
| resp | back to summary |
|---|---|
| private HttpServletResponse resp | |
| writer | back to summary |
|---|---|
| private PrintWriter writer | |
| NoBodyResponse | back to summary |
|---|---|
| pack-priv NoBodyResponse(HttpServletResponse r) | |
| addCookie | back to summary |
|---|---|
| public void addCookie(Cookie cookie) Implements javax. Doc from javax. 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 value) Implements javax. Doc from javax. 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 javax. Doc from javax. 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 javax. Doc from javax. 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 javax. Doc from javax. Returns a boolean indicating whether the named response header has already been set.
| |
| encodeRedirectURL | back to summary |
|---|---|
| public String encodeRedirectURL(String url) Implements javax. Doc from javax. Encodes the specified URL for use in the
All URLs sent to the | |
| encodeRedirectUrl | back to summary |
|---|---|
| public String encodeRedirectUrl(String url) Implements javax. Deprecated As of Version 2.1, replaced by
| |
| encodeURL | back to summary |
|---|---|
| public String encodeURL(String url) Implements javax. Doc from javax. Encodes the specified URL by including the session ID in it, 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. | |
| encodeUrl | back to summary |
|---|---|
| public String encodeUrl(String url) Implements javax. Deprecated As of Version 2.1, replaced by
| |
| flushBuffer | back to summary |
|---|---|
| public void flushBuffer() throws IOException Implements javax. Doc from javax. Forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written. | |
| getBufferSize | back to summary |
|---|---|
| public int getBufferSize() Implements javax. Doc from javax. Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.
| |
| getCharacterEncoding | back to summary |
|---|---|
| public String getCharacterEncoding() Implements javax. Doc from javax. Returns the name of the character encoding (MIME charset)
used for the body sent in this response.
The character encoding may have been specified explicitly
using the See RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt) for more information about character encoding and MIME.
| |
| getContentType | back to summary |
|---|---|
| public String getContentType() Implements javax. Doc from javax. Returns the content type used for the MIME body
sent in this response. The content type proper must
have been specified using
| |
| getLocale | back to summary |
|---|---|
| public Locale getLocale() Implements javax. Doc from javax. Returns the locale specified for this response
using the | |
| getOutputStream | back to summary |
|---|---|
| public ServletOutputStream getOutputStream() throws IOException Implements javax. Doc from javax. Returns a Calling flush() on the ServletOutputStream commits the response.
Either this method or
| |
| getWriter | back to summary |
|---|---|
| public PrintWriter getWriter() throws UnsupportedEncodingException Implements javax. Doc from javax. Returns a Calling flush() on the Either this method or
| |
| isCommitted | back to summary |
|---|---|
| public boolean isCommitted() Implements javax. Doc from javax. Returns a boolean indicating if the response has been committed. A commited response has already had its status code and headers written.
| |
| reset | back to summary |
|---|---|
| public void reset() throws IllegalStateException Implements javax. Doc from javax. Clears any data that exists in the buffer as well as the status code and
headers. If the response has been committed, this method throws an
| |
| resetBuffer | back to summary |
|---|---|
| public void resetBuffer() throws IllegalStateException Implements javax. Doc from javax. Clears the content of the underlying buffer in the response without
clearing headers or status code. If the
response has been committed, this method throws an
| |
| sendError | back to summary |
|---|---|
| public void sendError(int sc, String msg) throws IOException Implements javax. Doc from javax. Sends an error response to the client using the specified status. 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", leaving cookies and other headers unmodified. 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. 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 javax. Doc from javax. Sends an error response to the client using the specified status code and clearing the buffer. 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 javax. Doc from javax. Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root. 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.
| |
| setBufferSize | back to summary |
|---|---|
| public void setBufferSize(int size) throws IllegalStateException Implements javax. Doc from javax. Sets the preferred buffer size for the body of the response.
The servlet container will use a buffer at least as large as
the size requested. The actual buffer size used can be found
using A larger buffer allows more content to be written before anything is actually sent, thus providing the servlet with more time to set appropriate status codes and headers. A smaller buffer decreases server memory load and allows the client to start receiving data more quickly. This method must be called before any response body content is
written; if content has been written or the response object has
been committed, this method throws an
| |
| setCharacterEncoding | back to summary |
|---|---|
| public void setCharacterEncoding(String charset) Implements javax. Doc from javax. Sets the character encoding (MIME charset) of the response
being sent to the client, for example, to UTF-8.
If the character encoding has already been set by
This method can be called repeatedly to change the character
encoding.
This method has no effect if it is called after
Containers must communicate the character encoding used for
the servlet response's writer to the client if the protocol
provides a way for doing so. In the case of HTTP, the character
encoding is communicated as part of the
| |
| setContentLength | back to summary |
|---|---|
| pack-priv void setContentLength() | |
| setContentLength | back to summary |
|---|---|
| public void setContentLength(int len) Implements javax. Doc from javax. Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
| |
| setContentType | back to summary |
|---|---|
| public void setContentType(String type) Implements javax. Doc from javax. Sets the content type of the response being sent to
the client, if the response has not been committed yet.
The given content type may include a character encoding
specification, for example, This method may be called repeatedly to change content type and
character encoding.
This method has no effect if called after the response
has been committed. It does not set the response's character
encoding if it is called after Containers must communicate the content type and the character
encoding used for the servlet response's writer to the client if
the protocol provides a way for doing so. In the case of HTTP,
the
| |
| setDateHeader | back to summary |
|---|---|
| public void setDateHeader(String name, long date) Implements javax. Doc from javax. 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 javax. Doc from javax. 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 javax. Doc from javax. 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
| |
| setLocale | back to summary |
|---|---|
| public void setLocale(Locale loc) Implements javax. Doc from javax. Sets the locale of the response, if the response has not been
committed yet. It also sets the response's character encoding
appropriately for the locale, if the character encoding has not
been explicitly set using This method may be called repeatedly to change locale and
character encoding. The method has no effect if called after the
response has been committed. It does not set the response's
character encoding if it is called after Containers must communicate the locale and the character encoding
used for the servlet response's writer to the client if the protocol
provides a way for doing so. In the case of HTTP, the locale is
communicated via the
| |
| setStatus | back to summary |
|---|---|
| public void setStatus(int sc, String sm) Implements javax. Deprecated
| |
| setStatus | back to summary |
|---|---|
| public void setStatus(int sc) Implements javax. Doc from javax. 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 status codes SC_OK or SC_MOVED_TEMPORARILY). If there
is an error, and the caller wishes to invoke an error-page defined
in the web applicaion, the The container clears the buffer and sets the Location header, preserving cookies and other headers.
| |