All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface javax.servlet.http.HttpServletResponse

public interface HttpServletResponse
extends ServletResponse
This interface, implemented by network service developers, represents an HTTP servlet response. It allows a servlet's service method to manipulate HTTP-protocol specified header information, and return data to its client.


Variable Index

 o SC_ACCEPTED
Status code (202) indicating that a request was accepted for processing, but was not completed.
 o SC_BAD_GATEWAY
Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting as a proxy or gateway.
 o SC_BAD_REQUEST
Status code (400) indicating the request sent by the client was syntactically incorrect.
 o SC_CREATED
Status code (201) indicating the request succeeded and created a new resource on the server.
 o SC_FORBIDDEN
Status code (403) indicating the server understood the request but refused to fulfill it.
 o SC_INTERNAL_SERVER_ERROR
Status code (500) indicating an error inside the HTTP service which prevented it from fulfilling the request.
 o SC_MOVED_PERMANENTLY
Status code (301) indicating that the resource has permanently moved to a new location, and that future references should use a new URI with their requests.
 o SC_MOVED_TEMPORARILY
Status code (302) indicating that the resource has temporarily moved to another location, but that future references should still use the original URI to access the resource.
 o SC_NO_CONTENT
Status code (204) indicating that the request succeeded but that there was no new information to return.
 o SC_NOT_FOUND
Status code (404) indicating that the requested resource is not available.
 o SC_NOT_IMPLEMENTED
Status code (501) indicating the HTTP service does not support the functionality needed to fulfill the request.
 o SC_NOT_MODIFIED
Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.
 o SC_OK
Status code (200) indicating the request succeeded normally.
 o SC_SERVICE_UNAVAILABLE
Status code (503) indicating that the HTTP service is temporarily overloaded, and unable to handle the request.
 o SC_UNAUTHORIZED
Status code (401) indicating that the request requires HTTP authentication.

Method Index

 o containsHeader(String)
Returns true if the response message header has a field with the specified name.
 o sendError(int)
Sends an error response to the client using the specified status code and a default message.
 o sendError(int, String)
Sends an error response to the client using the specified status code and descriptive message.
 o sendRedirect(String)
Sends a redirect response to the client using the specified redirect location URL.
 o setDateHeader(String, long)
Adds a field to the response header with a given name and date-valued field.
 o setHeader(String, String)
Adds a field to the response header with a given name and value.
 o setIntHeader(String, int)
Adds a field to the response header with a given name and integer value.
 o setStatus(int)
Sets the status code and a default message for this response.
 o setStatus(int, String)
Sets the status code and message for this response.

Variables

 o SC_OK
 public static final int SC_OK
Status code (200) indicating the request succeeded normally.

 o SC_CREATED
 public static final int SC_CREATED
Status code (201) indicating the request succeeded and created a new resource on the server.

 o SC_ACCEPTED
 public static final int SC_ACCEPTED
Status code (202) indicating that a request was accepted for processing, but was not completed.

 o SC_NO_CONTENT
 public static final int SC_NO_CONTENT
Status code (204) indicating that the request succeeded but that there was no new information to return.

 o SC_MOVED_PERMANENTLY
 public static final int SC_MOVED_PERMANENTLY
Status code (301) indicating that the resource has permanently moved to a new location, and that future references should use a new URI with their requests.

 o SC_MOVED_TEMPORARILY
 public static final int SC_MOVED_TEMPORARILY
Status code (302) indicating that the resource has temporarily moved to another location, but that future references should still use the original URI to access the resource.

 o SC_NOT_MODIFIED
 public static final int SC_NOT_MODIFIED
Status code (304) indicating that a conditional GET operation found that the resource was available and not modified.

 o SC_BAD_REQUEST
 public static final int SC_BAD_REQUEST
Status code (400) indicating the request sent by the client was syntactically incorrect.

 o SC_UNAUTHORIZED
 public static final int SC_UNAUTHORIZED
Status code (401) indicating that the request requires HTTP authentication.

 o SC_FORBIDDEN
 public static final int SC_FORBIDDEN
Status code (403) indicating the server understood the request but refused to fulfill it.

 o SC_NOT_FOUND
 public static final int SC_NOT_FOUND
Status code (404) indicating that the requested resource is not available.

 o SC_INTERNAL_SERVER_ERROR
 public static final int SC_INTERNAL_SERVER_ERROR
Status code (500) indicating an error inside the HTTP service which prevented it from fulfilling the request.

 o SC_NOT_IMPLEMENTED
 public static final int SC_NOT_IMPLEMENTED
Status code (501) indicating the HTTP service does not support the functionality needed to fulfill the request.

 o SC_BAD_GATEWAY
 public static final int SC_BAD_GATEWAY
Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting as a proxy or gateway.

 o SC_SERVICE_UNAVAILABLE
 public static final int SC_SERVICE_UNAVAILABLE
Status code (503) indicating that the HTTP service is temporarily overloaded, and unable to handle the request.

Methods

 o containsHeader
 public abstract boolean containsHeader(String name)
Returns true if the response message header has a field with the specified name.

Parameters:
name - the header field name
 o setStatus
 public abstract void setStatus(int sc,
                                String sm)
Sets the status code and message for this response.

Parameters:
sc - the status code
sm - the status message
 o setStatus
 public abstract void setStatus(int sc)
Sets the status code and a default message for this response.

Parameters:
sc - the status code
 o setHeader
 public abstract void setHeader(String name,
                                String value)
Adds a field to the response header with a given name and value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field value
 o setIntHeader
 public abstract void setIntHeader(String name,
                                   int value)
Adds a field to the response header with a given name and integer value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field integer value
 o setDateHeader
 public abstract void setDateHeader(String name,
                                    long date)
Adds a field to the response header with a given name and date-valued field. The date is specified in terms of milliseconds since the epoch. If the date field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field date value
 o sendError
 public abstract void sendError(int sc,
                                String msg) throws IOException
Sends an error response to the client using the specified status code and descriptive message.

Parameters:
sc - the status code
msg - the detail message
Throws: IOException
If an I/O error has occurred.
 o sendError
 public abstract void sendError(int sc) throws IOException
Sends an error response to the client using the specified status code and a default message.

Parameters:
sc - the status code
Throws: IOException
If an I/O error has occurred.
 o sendRedirect
 public abstract void sendRedirect(String location) throws IOException
Sends a redirect response to the client using the specified redirect location URL. The URL must be absolute (e.g., https://hostname/path/file.html). Relative URLs are not permitted here.

Parameters:
location - the redirect location URL
Throws: IOException
If an I/O error has occurred.

All Packages  Class Hierarchy  This Package  Previous  Next  Index