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.
__100_Continue
public static final int __100_Continue
__101_Switching_Protocols
public static final int __101_Switching_Protocols
__102_Processing
public static final int __102_Processing
__200_OK
public static final int __200_OK
__201_Created
public static final int __201_Created
__202_Accepted
public static final int __202_Accepted
__203_Non_Authoritative_Information
public static final int __203_Non_Authoritative_Information
__204_No_Content
public static final int __204_No_Content
__205_Reset_Content
public static final int __205_Reset_Content
__206_Partial_Content
public static final int __206_Partial_Content
__207_Multi_Status
public static final int __207_Multi_Status
__300_Multiple_Choices
public static final int __300_Multiple_Choices
__301_Moved_Permanently
public static final int __301_Moved_Permanently
__302_Found
public static final int __302_Found
__302_Moved_Temporarily
public static final int __302_Moved_Temporarily
__303_See_Other
public static final int __303_See_Other
__304_Not_Modified
public static final int __304_Not_Modified
__305_Use_Proxy
public static final int __305_Use_Proxy
__400_Bad_Request
public static final int __400_Bad_Request
__401_Unauthorized
public static final int __401_Unauthorized
__402_Payment_Required
public static final int __402_Payment_Required
__403_Forbidden
public static final int __403_Forbidden
__404_Not_Found
public static final int __404_Not_Found
__405_Method_Not_Allowed
public static final int __405_Method_Not_Allowed
__406_Not_Acceptable
public static final int __406_Not_Acceptable
__407_Proxy_Authentication_Required
public static final int __407_Proxy_Authentication_Required
__408_Request_Timeout
public static final int __408_Request_Timeout
__409_Conflict
public static final int __409_Conflict
__410_Gone
public static final int __410_Gone
__411_Length_Required
public static final int __411_Length_Required
__412_Precondition_Failed
public static final int __412_Precondition_Failed
__413_Request_Entity_Too_Large
public static final int __413_Request_Entity_Too_Large
__414_Request_URI_Too_Large
public static final int __414_Request_URI_Too_Large
__415_Unsupported_Media_Type
public static final int __415_Unsupported_Media_Type
__416_Requested_Range_Not_Satisfiable
public static final int __416_Requested_Range_Not_Satisfiable
__417_Expectation_Failed
public static final int __417_Expectation_Failed
__422_Unprocessable_Entity
public static final int __422_Unprocessable_Entity
__423_Locked
public static final int __423_Locked
__424_Failed_Dependency
public static final int __424_Failed_Dependency
__500_Internal_Server_Error
public static final int __500_Internal_Server_Error
__501_Not_Implemented
public static final int __501_Not_Implemented
__502_Bad_Gateway
public static final int __502_Bad_Gateway
__503_Service_Unavailable
public static final int __503_Service_Unavailable
__504_Gateway_Timeout
public static final int __504_Gateway_Timeout
__505_HTTP_Version_Not_Supported
public static final int __505_HTTP_Version_Not_Supported
__507_Insufficient_Storage
public static final int __507_Insufficient_Storage
__statusMsg
public static final HashMap __statusMsg
addSetCookie
public void addSetCookie(String name,
String value)
Add a Set-Cookie field.
addSetCookie
public void addSetCookie(Cookie cookie)
Add a Set-Cookie field.
commit
public void commit()
throws IOException
completing
public void completing()
destroy
public void destroy()
Destroy the response.
Help the garbage collector by null everything that we can.
- destroy in interface HttpMessage
getHttpContext
public HttpContext getHttpContext()
Get the HttpContext handling this reponse.
- The HttpContext that is handling this request.
getHttpRequest
public HttpRequest getHttpRequest()
Get the HTTP Request.
Get the HTTP Request associated with this response.
getReason
public String getReason()
getRequest
public HttpRequest getRequest()
use getHttpRequest()
getStatus
public int getStatus()
isDirty
public boolean isDirty()
- isDirty in interface HttpMessage
- true if the message has been modified.
readHeader
public void readHeader(HttpInputStream in)
throws IOException
Not Implemented.
reset
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
.
- reset in interface HttpMessage
sendError
public void sendError(int code)
throws IOException
Sends an error response to the client using the specified status
code and no default message.
sendError
public void sendError(int code,
String message)
throws IOException
Send Error Response.
sendRedirect
public void sendRedirect(String location)
throws IOException
Sends a redirect response to the client using the specified redirect
location URL.
location
- the redirect location URL
setHttpContext
public void setHttpContext(HttpContext context)
Set the HttpContext handling this reponse.
context
- The HttpContext handling this reponse.
setReason
public void setReason(String reason)
setStatus
public void setStatus(int status)
setStatus
public void setStatus(int code,
String message)
writeHeader
public void writeHeader(Writer writer)
throws IOException
Write the message header.