public interface HttpServletResponse extends ServletResponse
Expires | Lets clients cache the page. Resin can use Expires to internally cache the page. |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(Cookie cookie)
Sends a new cookie to the client.
|
void |
addDateHeader(java.lang.String name,
long date)
Adds a header by converting a date to a string.
|
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds a header.
|
void |
addIntHeader(java.lang.String name,
int value)
Adds a header by converting an integer value to a string.
|
boolean |
containsHeader(java.lang.String name)
Returns true if the output headers include
name |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Deprecated.
|
java.lang.String |
encodeRedirectURL(java.lang.String name)
Encodes session information in a URL suitable for
sendRedirect() |
java.lang.String |
encodeUrl(java.lang.String url)
Deprecated.
|
java.lang.String |
encodeURL(java.lang.String url)
Encodes session information in a URL.
|
java.lang.String |
getHeader(java.lang.String name)
Retuns value of header with a given name
|
java.util.Collection<java.lang.String> |
getHeaderNames()
Returns an Iterable for header names set via
setHeader(java.lang.String, java.lang.String) , addHeader(java.lang.String, java.lang.String) , setDateHeader(java.lang.String, long) , addDateHeader(java.lang.String, long) , setIntHeader(java.lang.String, int) , or addIntHeader(java.lang.String, int) , respectively. |
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name)
Returns an Iterable for header values with a given name
|
int |
getStatus()
Returns the current status code of this response
|
void |
sendError(int sc)
Sends an HTTP error page based on the status code
|
void |
sendError(int sc,
java.lang.String msg)
Sends an HTTP error page based on the status code
|
void |
sendRedirect(java.lang.String location)
Redirects the client to another page.
|
void |
setDateHeader(java.lang.String name,
long date)
Sets a header by converting a date to a string.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets a header.
|
void |
setIntHeader(java.lang.String name,
int value)
Sets a header by converting an integer value to a string.
|
void |
setStatus(int sc)
Sets the HTTP status
|
void |
setStatus(int sc,
java.lang.String msg)
Deprecated.
|
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale
static final int SC_ACCEPTED
static final int SC_BAD_GATEWAY
static final int SC_BAD_REQUEST
static final int SC_CONFLICT
static final int SC_CONTINUE
static final int SC_CREATED
static final int SC_EXPECTATION_FAILED
static final int SC_FORBIDDEN
static final int SC_GATEWAY_TIMEOUT
static final int SC_GONE
static final int SC_HTTP_VERSION_NOT_SUPPORTED
static final int SC_INTERNAL_SERVER_ERROR
static final int SC_LENGTH_REQUIRED
static final int SC_METHOD_NOT_ALLOWED
static final int SC_MOVED_PERMANENTLY
static final int SC_MOVED_TEMPORARILY
static final int SC_FOUND
static final int SC_MULTIPLE_CHOICES
static final int SC_NO_CONTENT
static final int SC_NON_AUTHORITATIVE_INFORMATION
static final int SC_NOT_ACCEPTABLE
static final int SC_NOT_FOUND
static final int SC_NOT_IMPLEMENTED
static final int SC_NOT_MODIFIED
static final int SC_OK
static final int SC_PARTIAL_CONTENT
static final int SC_PAYMENT_REQUIRED
static final int SC_PRECONDITION_FAILED
static final int SC_PROXY_AUTHENTICATION_REQUIRED
static final int SC_REQUEST_ENTITY_TOO_LARGE
static final int SC_REQUEST_TIMEOUT
static final int SC_REQUEST_URI_TOO_LONG
static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE
static final int SC_RESET_CONTENT
static final int SC_SEE_OTHER
static final int SC_SERVICE_UNAVAILABLE
static final int SC_SWITCHING_PROTOCOLS
static final int SC_UNAUTHORIZED
static final int SC_UNSUPPORTED_MEDIA_TYPE
static final int SC_USE_PROXY
static final int SC_TEMPORARY_REDIRECT
void setStatus(int sc)
sc
- the HTTP status codevoid sendError(int sc, java.lang.String msg) throws java.io.IOException
sc
- the HTTP status codejava.io.IOException
void sendError(int sc) throws java.io.IOException
sc
- the HTTP status codejava.io.IOException
void sendRedirect(java.lang.String location) throws java.io.IOException
location
- the location to redirect to.java.io.IOException
void setHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valuevoid addHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valueboolean containsHeader(java.lang.String name)
name
name
- the header name to testvoid setDateHeader(java.lang.String name, long date)
To set the page to expire in 15 seconds use the following:
long now = System.currentTime();
response.setDateHeader("Expires", now + 15000);
name
- name of the headerdate
- the date in milliseconds since the epoch.void addDateHeader(java.lang.String name, long date)
name
- name of the headerdate
- the date in milliseconds since the epoch.void setIntHeader(java.lang.String name, int value)
name
- name of the headervalue
- the value as an integervoid addIntHeader(java.lang.String name, int value)
name
- name of the headervalue
- the value as an integervoid addCookie(Cookie cookie)
java.lang.String encodeURL(java.lang.String url)
url
- the url to encodejava.lang.String encodeRedirectURL(java.lang.String name)
sendRedirect()
name
- the url to encodevoid setStatus(int sc, java.lang.String msg)
java.lang.String encodeUrl(java.lang.String url)
java.lang.String encodeRedirectUrl(java.lang.String url)
int getStatus()
java.lang.String getHeader(java.lang.String name)
name
- java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
name
- java.util.Collection<java.lang.String> getHeaderNames()
setHeader(java.lang.String, java.lang.String)
, addHeader(java.lang.String, java.lang.String)
, setDateHeader(java.lang.String, long)
, addDateHeader(java.lang.String, long)
, setIntHeader(java.lang.String, int)
, or addIntHeader(java.lang.String, int)
, respectively.