org.mortbay.http
Class HttpResponse
public
class
HttpResponse
extends HttpMessage
HTTP Response.
This class manages the headers, trailers and content streams
of a HTTP response. It can be used for receiving or generating
requests.
This class is not synchronized. It should be explicitly
synchronized if it is used by multiple threads.
Version: $Id: HttpResponse.java,v 1.61 2005/10/26 08:10:14 gregwilkins Exp $
Author: Greg Wilkins (gregw)
See Also: HttpRequest
public static final int __100_Continue
public static final int __101_Switching_Protocols
public static final int __102_Processing
public static final int __200_OK
public static final int __201_Created
public static final int __202_Accepted
public static final int __203_Non_Authoritative_Information
public static final int __204_No_Content
public static final int __205_Reset_Content
public static final int __206_Partial_Content
public static final int __207_Multi_Status
public static final int __300_Multiple_Choices
public static final int __301_Moved_Permanently
public static final int __302_Found
public static final int __302_Moved_Temporarily
public static final int __303_See_Other
public static final int __304_Not_Modified
public static final int __305_Use_Proxy
public static final int __400_Bad_Request
public static final int __401_Unauthorized
public static final int __402_Payment_Required
public static final int __403_Forbidden
public static final int __404_Not_Found
public static final int __405_Method_Not_Allowed
public static final int __406_Not_Acceptable
public static final int __407_Proxy_Authentication_Required
public static final int __408_Request_Timeout
public static final int __409_Conflict
public static final int __410_Gone
public static final int __411_Length_Required
public static final int __412_Precondition_Failed
public static final int __413_Request_Entity_Too_Large
public static final int __414_Request_URI_Too_Large
public static final int __415_Unsupported_Media_Type
public static final int __416_Requested_Range_Not_Satisfiable
public static final int __417_Expectation_Failed
public static final int __422_Unprocessable_Entity
public static final int __423_Locked
public static final int __424_Failed_Dependency
public static final int __500_Internal_Server_Error
public static final int __501_Not_Implemented
public static final int __502_Bad_Gateway
public static final int __503_Service_Unavailable
public static final int __504_Gateway_Timeout
public static final int __505_HTTP_Version_Not_Supported
public static final int __507_Insufficient_Storage
public static final HashMap __statusMsg
public HttpResponse()
Constructor.
Constructor.
Parameters: connection
public void addSetCookie(String name, String value)
Add a Set-Cookie field.
public void addSetCookie(
Cookie cookie)
Add a Set-Cookie field.
public void commit()
public void completing()
public void destroy()
Destroy the response.
Help the garbage collector by null everything that we can.
Get the HttpContext handling this reponse.
Returns: The HttpContext that is handling this request.
Get the HTTP Request.
Get the HTTP Request associated with this response.
Returns: associated request
public String getReason()
Deprecated: use getHttpRequest()
public int getStatus()
public boolean isDirty()
Returns: true if the message has been modified.
Not Implemented.
Parameters: in
Throws: IOException
public void reset()
Reset the response.
Clears any data that exists in the buffer as well as the status
code. If the response has been committed, this method throws an
IllegalStateException
.
Throws: IllegalStateException if the response has already been
committed
public void sendError(int code, String message)
Send Error Response.
public void sendError(int code)
Sends an error response to the client using the specified status
code and no default message.
Parameters: code the status code
Throws: IOException If an I/O error has occurred.
public void sendRedirect(String location)
Sends a redirect response to the client using the specified redirect
location URL.
Parameters: location the redirect location URL
Throws: IOException If an I/O error has occurred.
Set the HttpContext handling this reponse.
Parameters: context The HttpContext handling this reponse.
public void setReason(String reason)
public void setStatus(int status)
public void setStatus(int code, String message)
public void writeHeader(Writer writer)
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.