|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
HttpServletResponse extends ServletResponse allowing servlets to set the status and headers.
Expires | Lets clients cache the page. Resin can use Expires to internally cache the page. |
Method Summary | |
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. |
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. |
Methods inherited from interface javax.servlet.ServletResponse |
flushBuffer, getBufferSize, getCharacterEncoding, getLocale, getOutputStream, getWriter, isCommitted, reset, setBufferSize, setContentLength, setContentType, setLocale |
Field Detail |
public static final int SC_ACCEPTED
public static final int SC_BAD_GATEWAY
public static final int SC_BAD_REQUEST
public static final int SC_CONFLICT
public static final int SC_CONTINUE
public static final int SC_CREATED
public static final int SC_EXPECTATION_FAILED
public static final int SC_FORBIDDEN
public static final int SC_GATEWAY_TIMEOUT
public static final int SC_GONE
public static final int SC_HTTP_VERSION_NOT_SUPPORTED
public static final int SC_INTERNAL_SERVER_ERROR
public static final int SC_LENGTH_REQUIRED
public static final int SC_METHOD_NOT_ALLOWED
public static final int SC_MOVED_PERMANENTLY
public static final int SC_MOVED_TEMPORARILY
public static final int SC_MULTIPLE_CHOICES
public static final int SC_NO_CONTENT
public static final int SC_NON_AUTHORITATIVE_INFORMATION
public static final int SC_NOT_ACCEPTABLE
public static final int SC_NOT_FOUND
public static final int SC_NOT_IMPLEMENTED
public static final int SC_NOT_MODIFIED
public static final int SC_OK
public static final int SC_PARTIAL_CONTENT
public static final int SC_PAYMENT_REQUIRED
public static final int SC_PRECONDITION_FAILED
public static final int SC_PROXY_AUTHENTICATION_REQUIRED
public static final int SC_REQUEST_ENTITY_TOO_LARGE
public static final int SC_REQUEST_TIMEOUT
public static final int SC_REQUEST_URI_TOO_LONG
public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE
public static final int SC_RESET_CONTENT
public static final int SC_SEE_OTHER
public static final int SC_SERVICE_UNAVAILABLE
public static final int SC_SWITCHING_PROCOTOLS
public static final int SC_UNAUTHORIZED
public static final int SC_UNSUPPORTED_MEDIA_TYPE
public static final int SC_USE_PROXY_TYPE
Method Detail |
public void setStatus(int sc)
sc
- the HTTP status codepublic void sendError(int sc, java.lang.String msg) throws java.io.IOException
sc
- the HTTP status codepublic void sendError(int sc) throws java.io.IOException
sc
- the HTTP status codepublic void sendRedirect(java.lang.String location) throws java.io.IOException
location
- the location to redirect to.public void setHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valuepublic void addHeader(java.lang.String name, java.lang.String value)
name
- the header namevalue
- the header valuepublic boolean containsHeader(java.lang.String name)
name
name
- the header name to testpublic void 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.public void addDateHeader(java.lang.String name, long date)
name
- name of the headerdate
- the date in milliseconds since the epoch.public void setIntHeader(java.lang.String name, int value)
name
- name of the headervalue
- the value as an integerpublic void addIntHeader(java.lang.String name, int value)
name
- name of the headervalue
- the value as an integerpublic void addCookie(Cookie cookie)
public java.lang.String encodeURL(java.lang.String url)
url
- the url to encodepublic java.lang.String encodeRedirectURL(java.lang.String name)
sendRedirect()
url
- the url to encodepublic void setStatus(int sc, java.lang.String msg)
public java.lang.String encodeUrl(java.lang.String url)
public java.lang.String encodeRedirectUrl(java.lang.String url)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |