Package com.jsgalactic.axiom.http
Class HttpStatus
java.lang.Object
com.jsgalactic.axiom.http.HttpStatus
Status codes used by Axiom applications and runtimes, with their RFC 9110 reason phrases. Plain
int constants keep Response and handler code free of wrapper types.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int202 Accepted.static final int502 Bad Gateway.static final int400 Bad Request.static final int409 Conflict.static final int413 Content Too Large.static final int201 Created; pair with a Location header.static final int417 Expectation Failed.static final int403 Forbidden.static final int302 Found.static final int504 Gateway Timeout.static final int410 Gone.static final int505 HTTP Version Not Supported.static final int500 Internal Server Error.static final int411 Length Required.static final int405 Method Not Allowed.static final int301 Moved Permanently.static final int204 No Content; never carries a body.static final int406 Not Acceptable.static final int404 Not Found.static final int501 Not Implemented.static final int304 Not Modified; never carries a body.static final int200 OK.static final int206 Partial Content; carries one range or a multipart/byteranges body.static final int308 Permanent Redirect.static final int412 Precondition Failed.static final int428 Precondition Required.static final int416 Range Not Satisfiable; carries Content-Range with an asterisk.static final int431 Request Header Fields Too Large.static final int408 Request Timeout.static final int205 Reset Content; never carries a body.static final int303 See Other.static final int503 Service Unavailable.static final int307 Temporary Redirect.static final int429 Too Many Requests.static final int401 Unauthorized.static final int422 Unprocessable Content.static final int415 Unsupported Media Type.static final int414 URI Too Long. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdefaultCode(int status) Returns the default machine-readable error code for a status: its reason phrase in lowercase with spaces replaced by underscores, for examplenot_found.static StringreasonPhrase(int status) Returns the RFC 9110 reason phrase for a status listed in this class, or a generic phrase for its class (for example "Client Error") otherwise.
-
Field Details
-
OK
public static final int OK200 OK.- See Also:
-
CREATED
public static final int CREATED201 Created; pair with a Location header.- See Also:
-
ACCEPTED
public static final int ACCEPTED202 Accepted.- See Also:
-
NO_CONTENT
public static final int NO_CONTENT204 No Content; never carries a body.- See Also:
-
RESET_CONTENT
public static final int RESET_CONTENT205 Reset Content; never carries a body.- See Also:
-
PARTIAL_CONTENT
public static final int PARTIAL_CONTENT206 Partial Content; carries one range or a multipart/byteranges body.- See Also:
-
MOVED_PERMANENTLY
public static final int MOVED_PERMANENTLY301 Moved Permanently.- See Also:
-
FOUND
public static final int FOUND302 Found.- See Also:
-
SEE_OTHER
public static final int SEE_OTHER303 See Other.- See Also:
-
NOT_MODIFIED
public static final int NOT_MODIFIED304 Not Modified; never carries a body.- See Also:
-
TEMPORARY_REDIRECT
public static final int TEMPORARY_REDIRECT307 Temporary Redirect.- See Also:
-
PERMANENT_REDIRECT
public static final int PERMANENT_REDIRECT308 Permanent Redirect.- See Also:
-
BAD_REQUEST
public static final int BAD_REQUEST400 Bad Request.- See Also:
-
UNAUTHORIZED
public static final int UNAUTHORIZED401 Unauthorized.- See Also:
-
FORBIDDEN
public static final int FORBIDDEN403 Forbidden.- See Also:
-
NOT_FOUND
public static final int NOT_FOUND404 Not Found.- See Also:
-
METHOD_NOT_ALLOWED
public static final int METHOD_NOT_ALLOWED405 Method Not Allowed.- See Also:
-
NOT_ACCEPTABLE
public static final int NOT_ACCEPTABLE406 Not Acceptable.- See Also:
-
REQUEST_TIMEOUT
public static final int REQUEST_TIMEOUT408 Request Timeout.- See Also:
-
CONFLICT
public static final int CONFLICT409 Conflict.- See Also:
-
GONE
public static final int GONE410 Gone.- See Also:
-
LENGTH_REQUIRED
public static final int LENGTH_REQUIRED411 Length Required.- See Also:
-
PRECONDITION_FAILED
public static final int PRECONDITION_FAILED412 Precondition Failed.- See Also:
-
CONTENT_TOO_LARGE
public static final int CONTENT_TOO_LARGE413 Content Too Large.- See Also:
-
URI_TOO_LONG
public static final int URI_TOO_LONG414 URI Too Long.- See Also:
-
UNSUPPORTED_MEDIA_TYPE
public static final int UNSUPPORTED_MEDIA_TYPE415 Unsupported Media Type.- See Also:
-
RANGE_NOT_SATISFIABLE
public static final int RANGE_NOT_SATISFIABLE416 Range Not Satisfiable; carries Content-Range with an asterisk.- See Also:
-
EXPECTATION_FAILED
public static final int EXPECTATION_FAILED417 Expectation Failed.- See Also:
-
UNPROCESSABLE_CONTENT
public static final int UNPROCESSABLE_CONTENT422 Unprocessable Content.- See Also:
-
PRECONDITION_REQUIRED
public static final int PRECONDITION_REQUIRED428 Precondition Required.- See Also:
-
TOO_MANY_REQUESTS
public static final int TOO_MANY_REQUESTS429 Too Many Requests.- See Also:
-
REQUEST_HEADER_FIELDS_TOO_LARGE
public static final int REQUEST_HEADER_FIELDS_TOO_LARGE431 Request Header Fields Too Large.- See Also:
-
INTERNAL_SERVER_ERROR
public static final int INTERNAL_SERVER_ERROR500 Internal Server Error.- See Also:
-
NOT_IMPLEMENTED
public static final int NOT_IMPLEMENTED501 Not Implemented.- See Also:
-
BAD_GATEWAY
public static final int BAD_GATEWAY502 Bad Gateway.- See Also:
-
SERVICE_UNAVAILABLE
public static final int SERVICE_UNAVAILABLE503 Service Unavailable.- See Also:
-
GATEWAY_TIMEOUT
public static final int GATEWAY_TIMEOUT504 Gateway Timeout.- See Also:
-
HTTP_VERSION_NOT_SUPPORTED
public static final int HTTP_VERSION_NOT_SUPPORTED505 HTTP Version Not Supported.- See Also:
-
-
Method Details
-
reasonPhrase
Returns the RFC 9110 reason phrase for a status listed in this class, or a generic phrase for its class (for example "Client Error") otherwise.- Parameters:
status- final status, 200 through 599- Returns:
- reason phrase
- Throws:
IllegalArgumentException- if the status is not a final status
-
defaultCode
Returns the default machine-readable error code for a status: its reason phrase in lowercase with spaces replaced by underscores, for examplenot_found.- Parameters:
status- final status- Returns:
- safe error code
-