Class sun.server.http.HttpResponse
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.server.http.HttpResponse

java.lang.Object
   |
   +----sun.server.http.HttpResponse

public class HttpResponse
extends Object
implements HttpServletResponse
This class represents an HTTP response message.

Method Index

 o getOutputStream()
Returns the output stream for writing response data.
 o getStatusCode()
Returns the status code for this response.
 o sendError(int)
Writes an error response using the specified status code.
 o sendError(int, String)
Writes an error response using the specified status code and detail message.
 o sendRedirect(String)
Sends a redirect response to the client using the specified redirect location.
 o setContentLength(int)
Sets the content length for this response.
 o setContentType(String)
Sets the content type for this response.
 o setDateHeader(String, long)
Sets the value of a date header field.
 o setHeader(String, String)
Sets the value of a header field.
 o setIntHeader(String, int)
Sets the value of an integer header field.
 o setStatus(int)
Sets the status code for this response with a default status message.
 o setStatus(int, String)
Sets the status code and message for this response.
 o statusMsg(int)
Returns a default status message for the specified status code.
 o unsetHeader(String)
Unsets the value of a header field.

Methods

 o setStatus
  public 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 void setStatus(int sc)
Sets the status code for this response with a default status message.
Parameters:
sc - the status code
 o statusMsg
  protected String statusMsg(int sc)
Returns a default status message for the specified status code.
 o getStatusCode
  public int getStatusCode()
Returns the status code for this response.
 o setContentLength
  public void setContentLength(int n)
Sets the content length for this response.
 o setContentType
  public void setContentType(String s)
Sets the content type for this response.
 o setHeader
  public void setHeader(String name,
                        String value)
Sets the value of a header field.
Parameters:
name - the header field name
value - the header field value
 o setIntHeader
  public void setIntHeader(String name,
                           int value)
Sets the value of an integer header field.
Parameters:
name - the header field name
value - the header field value
 o setDateHeader
  public void setDateHeader(String name,
                            long value)
Sets the value of a date header field.
Parameters:
name - the header field name
value - the header field value
 o unsetHeader
  public void unsetHeader(String name)
Unsets the value of a header field.
Parameters:
name - the header field name
 o getOutputStream
  public ServletOutputStream getOutputStream()
Returns the output stream for writing response data.
 o sendError
  public void sendError(int sc) throws IOException
Writes an error response using the specified status code. Since no detail message is specified here, correspnding site-specific error html file will be shipped if available.
Parameters:
sc - the status code
Throws: IOException
If an I/O error has occurred.
 o sendError
  public void sendError(int sc,
                        String msg) throws IOException
Writes an error response using the specified status code and detail message.
Parameters:
sc - the status code
msg - the detail message
Throws: IOException
If an I/O error has occurred.
 o sendRedirect
  public void sendRedirect(String location) throws IOException
Sends a redirect response to the client using the specified redirect location.
Parameters:
location - the redirect location URL
Throws: IOException
If an I/O error has occurred.

All Packages  Class Hierarchy  This Package  Previous  Next  Index