public class HttpReply extends Object
The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request.
These codes are fully defined in section 10. The Reason-Phrase is intended to give a short textual description of the Status-Code.
The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase.
The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:
1xx: Informational - Request received, continuing process 2xx: Success - The action was successfully received, understood, and accepted 3xx: Redirection - Further action must be taken in order to complete the request 4xx: Client Error - The request contains bad syntax or cannot be fulfilled 5xx: Server Error - The server failed to fulfill an apparently valid request
Constructor and Description |
---|
HttpReply(HttpWebServer webServer)
The constructor tries to load a default error document called
default.html in the error directory.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
createErrorReply(HttpSession session,
int errCode)
Creates an error reply for a session.
|
byte[] |
createErrorReply(HttpSession session,
int errCode,
String errExtra)
Creates an error reply for a session.
|
byte[] |
createErrorReply(HttpSession session,
int errCode,
String[] fields)
Creates an error reply for a session.
|
byte[] |
createErrorReply(HttpSession session,
int errCode,
String errExtra,
String[] fields)
Creates an error reply for a session.
|
byte[] |
createFoundRedirection(HttpSession session,
String uri)
Creates the found redirection error reply.
|
byte[] |
createMethodNotAllowedError(HttpSession session)
Creates the method not allowed reply.
|
byte[] |
createNormalReply(HttpSession session,
byte[] data)
Creates an normal reply for a session.
|
byte[] |
createNormalReply(HttpSession session,
int dataLength)
Deprecated.
|
byte[] |
createNormalReply(HttpSession session,
long dataLength)
Creates an normal reply for a session.
|
byte[] |
createNormalReply(HttpSession session,
String data)
Creates an normal reply for a session.
|
byte[] |
createOnlyPostMethodAllowedError(HttpSession session)
Creates the method not allowed reply.
|
HtmlResource |
getErrorDocument(int errCode)
Gets the error document for an error code.
|
String |
getErrorText(int errCode)
Gets the error text for an error code.
|
public static final String HR_100
public static final String HR_101
public static final String HR_200
public static final String HR_201
public static final String HR_202
public static final String HR_203
public static final String HR_204
public static final String HR_205
public static final String HR_206
public static final String HR_300
public static final String HR_301
public static final String HR_302
public static final String HR_303
public static final String HR_304
public static final String HR_305
public static final String HR_307
public static final String HR_400
public static final String HR_401
public static final String HR_402
public static final String HR_403
public static final String HR_404
public static final String HR_405
public static final String HR_406
public static final String HR_407
public static final String HR_408
public static final String HR_409
public static final String HR_410
public static final String HR_411
public static final String HR_412
public static final String HR_413
public static final String HR_414
public static final String HR_415
public static final String HR_416
public static final String HR_417
public static final String HR_500
public static final String HR_501
public static final String HR_502
public static final String HR_503
public static final String HR_504
public static final String HR_505
public static final int EC_Created
public static final int EC_Accepted
public static final int EC_Non_Authoritative_Information
public static final int EC_No_Content
public static final int EC_Reset_Content
public static final int EC_Partial_Content
public static final int EC_Multiple_Choices
public static final int EC_Moved_Permanently
public static final int EC_Found
public static final int EC_See_Other
public static final int EC_Not_Modified
public static final int EC_Use_Proxy
public static final int EC_Temporary_Redirect
public static final int EC_Bad_Request
public static final int EC_Unauthorized
public static final int EC_Payment_Required
public static final int EC_Forbidden
public static final int EC_Not_Found
public static final int EC_Method_Not_Allowed
public static final int EC_Not_Acceptable
public static final int EC_Proxy_Authentication_Required
public static final int EC_Request_Time_out
public static final int EC_Conflict
public static final int EC_Gone
public static final int EC_Length_Required
public static final int EC_Precondition_Failed
public static final int EC_Request_Entity_Too_Large
public static final int EC_Request_URI_Too_Large
public static final int EC_Unsupported_Media_Type
public static final int EC_Requested_range_not_satisfiable
public static final int EC_Expectation_Failed
public static final int EC_Internal_Server_Error
public static final int EC_Not_Implemented
public static final int EC_Bad_Gateway
public static final int EC_Service_Unavailable
public static final int EC_Gateway_Time_out
public static final int EC_HTTP_Version_not_supported
public final int webServerHeaderReadTimeout
The default timeout used in NetPhantom is indefinite.
public final int webServerKeepAliveTimeout
The default keep-alive timeout used in NetPhantom is 20 seconds.
public HttpReply(HttpWebServer webServer) throws IOException
IOException
- if the HTML documents cannot be loaded.public String getErrorText(int errCode)
public HtmlResource getErrorDocument(int errCode)
public byte[] createMethodNotAllowedError(HttpSession session)
public byte[] createOnlyPostMethodAllowedError(HttpSession session)
public byte[] createErrorReply(HttpSession session, int errCode)
public byte[] createErrorReply(HttpSession session, int errCode, String errExtra)
public byte[] createErrorReply(HttpSession session, int errCode, String[] fields)
public byte[] createErrorReply(HttpSession session, int errCode, String errExtra, String[] fields)
public byte[] createFoundRedirection(HttpSession session, String uri)
@Deprecated public byte[] createNormalReply(HttpSession session, int dataLength)
public byte[] createNormalReply(HttpSession session, long dataLength)
public byte[] createNormalReply(HttpSession session, String data)
public byte[] createNormalReply(HttpSession session, byte[] data)
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.