public class HttpResponse extends HttpMessage
HttpRequest
HttpMessage.HeaderWriter
__HTTP_0_9, __HTTP_1_0, __HTTP_1_1, __HTTP_1_X, __MSG_BAD, __MSG_EDITABLE, __MSG_RECEIVED, __MSG_SENDING, __MSG_SENT, __SCHEME, __SSL_SCHEME, __state, _attributes, _characterEncoding, _connection, _dotVersion, _header, _mimeType, _state, _version, _wrapper
Constructor and Description |
---|
HttpResponse()
Constructor.
|
HttpResponse(HttpConnection connection)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addSetCookie(javax.servlet.http.Cookie cookie)
Add a Set-Cookie field.
|
void |
addSetCookie(String name,
String value)
Add a Set-Cookie field.
|
void |
commit() |
void |
completing() |
void |
destroy()
Destroy the response.
|
HttpContext |
getHttpContext()
Get the HttpContext handling this reponse.
|
HttpRequest |
getHttpRequest()
Get the HTTP Request.
|
String |
getReason() |
HttpRequest |
getRequest()
Deprecated.
use getHttpRequest()
|
int |
getStatus() |
boolean |
isDirty() |
void |
readHeader(HttpInputStream in)
Not Implemented.
|
void |
reset()
Reset the response.
|
void |
sendError(int code)
Sends an error response to the client using the specified status
code and no default message.
|
void |
sendError(int code,
String message)
Send Error Response.
|
void |
sendRedirect(String location)
Sends a redirect response to the client using the specified redirect
location URL.
|
void |
setHttpContext(HttpContext context)
Set the HttpContext handling this reponse.
|
void |
setReason(String reason) |
void |
setStatus(int status) |
void |
setStatus(int code,
String message) |
void |
writeHeader(Writer writer)
Write the message header.
|
addDateField, addDateField, addField, addIntField, containsField, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDateField, getDotVersion, getField, getFieldNames, getFieldValues, getFieldValues, getHeader, getHttpConnection, getInputStream, getIntField, getMimeType, getOutputStream, getState, getVersion, getWrapper, isCommitted, removeAttribute, removeField, setAttribute, setCharacterEncoding, setContentLength, setContentType, setDateField, setDateField, setField, setField, setIntField, setState, setVersion, setWrapper, toString, updateMimeType
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_Moved_Temporarily
public static final int __302_Found
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()
public HttpResponse(HttpConnection connection)
connection
- public HttpContext getHttpContext()
public void setHttpContext(HttpContext context)
context
- The HttpContext handling this reponse.public boolean isDirty()
isDirty
in class HttpMessage
public void reset()
IllegalStateException
.reset
in class HttpMessage
IllegalStateException
- if the response has already been
committedpublic HttpRequest getRequest()
public HttpRequest getHttpRequest()
public void readHeader(HttpInputStream in) throws IOException
in
- IOException
public void writeHeader(Writer writer) throws IOException
HttpMessage
IOException
public int getStatus()
public void setStatus(int status)
public String getReason()
public void setReason(String reason)
public void setStatus(int code, String message)
public void sendError(int code, String message) throws IOException
IOException
public void sendError(int code) throws IOException
code
- the status codeIOException
- If an I/O error has occurred.public void sendRedirect(String location) throws IOException
location
- the redirect location URLIOException
- If an I/O error has occurred.public void addSetCookie(javax.servlet.http.Cookie cookie)
public void completing()
public void commit() throws IOException
IOException
public void destroy()
destroy
in class HttpMessage
Copyright © 2016. All Rights Reserved.