Package com.linecorp.armeria.common
Class HttpStatus
java.lang.Object
com.linecorp.armeria.common.HttpStatus
- All Implemented Interfaces:
Comparable<HttpStatus>
public final class HttpStatus extends Object implements Comparable<HttpStatus>
HTTP response code and its description.
-
Field Summary
Fields Modifier and Type Field Description static HttpStatus
ACCEPTED
202 Accepted.static HttpStatus
BAD_GATEWAY
502 Bad Gateway.static HttpStatus
BAD_REQUEST
400 Bad Request.static HttpStatus
CLIENT_CLOSED_REQUEST
499 Client Closed Request.static HttpStatus
CONFLICT
409 Conflict.static HttpStatus
CONTINUE
100 Continue.static HttpStatus
CREATED
201 Created.static HttpStatus
EXPECTATION_FAILED
417 Expectation Failed.static HttpStatus
FAILED_DEPENDENCY
424 Failed Dependency (WebDAV, RFC4918).static HttpStatus
FORBIDDEN
403 Forbidden.static HttpStatus
FOUND
302 Found.static HttpStatus
GATEWAY_TIMEOUT
504 Gateway Timeout.static HttpStatus
GONE
410 Gone.static HttpStatus
HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported.static HttpStatus
INSUFFICIENT_STORAGE
507 Insufficient Storage (WebDAV, RFC4918).static HttpStatus
INTERNAL_SERVER_ERROR
500 Internal Server Error.static HttpStatus
LENGTH_REQUIRED
411 Length Required.static HttpStatus
LOCKED
423 Locked (WebDAV, RFC4918).static HttpStatus
METHOD_NOT_ALLOWED
405 Method Not Allowed.static HttpStatus
MISDIRECTED_REQUEST
421 Misdirected Request.static HttpStatus
MOVED_PERMANENTLY
301 Moved Permanently.static HttpStatus
MULTI_STATUS
207 Multi-Status (WebDAV, RFC2518).static HttpStatus
MULTIPLE_CHOICES
300 Multiple Choices.static HttpStatus
NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required (RFC6585).static HttpStatus
NO_CONTENT
204 No Content.static HttpStatus
NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information (since HTTP/1.1).static HttpStatus
NOT_ACCEPTABLE
406 Not Acceptable.static HttpStatus
NOT_EXTENDED
510 Not Extended (RFC2774).static HttpStatus
NOT_FOUND
404 Not Found.static HttpStatus
NOT_IMPLEMENTED
501 Not Implemented.static HttpStatus
NOT_MODIFIED
304 Not Modified.static HttpStatus
OK
200 OK.static HttpStatus
PARTIAL_CONTENT
206 Partial Content.static HttpStatus
PAYMENT_REQUIRED
402 Payment Required.static HttpStatus
PRECONDITION_FAILED
412 Precondition Failed.static HttpStatus
PRECONDITION_REQUIRED
428 Precondition Required (RFC6585).static HttpStatus
PROCESSING
102 Processing (WebDAV, RFC2518).static HttpStatus
PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required.static HttpStatus
REQUEST_ENTITY_TOO_LARGE
413 Request Entity Too Large.static HttpStatus
REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large (RFC6585).static HttpStatus
REQUEST_TIMEOUT
408 Request Timeout.static HttpStatus
REQUEST_URI_TOO_LONG
414 Request-URI Too Long.static HttpStatus
REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable.static HttpStatus
RESET_CONTENT
205 Reset Content.static HttpStatus
SEE_OTHER
303 See Other (since HTTP/1.1).static HttpStatus
SERVICE_UNAVAILABLE
503 Service Unavailable.static HttpStatus
SWITCHING_PROTOCOLS
101 Switching Protocols.static HttpStatus
TEMPORARY_REDIRECT
307 Temporary Redirect (since HTTP/1.1).static HttpStatus
TOO_MANY_REQUESTS
429 Too Many Requests (RFC6585).static HttpStatus
UNAUTHORIZED
401 Unauthorized.static HttpStatus
UNKNOWN
A special status code '0' which represents that the response status is unknown.static HttpStatus
UNORDERED_COLLECTION
425 Unordered Collection (WebDAV, RFC3648).static HttpStatus
UNPROCESSABLE_ENTITY
422 Unprocessable Entity (WebDAV, RFC4918).static HttpStatus
UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type.static HttpStatus
UPGRADE_REQUIRED
426 Upgrade Required (RFC2817).static HttpStatus
USE_PROXY
305 Use Proxy (since HTTP/1.1).static HttpStatus
VARIANT_ALSO_NEGOTIATES
506 Variant Also Negotiates (RFC2295). -
Constructor Summary
Constructors Constructor Description HttpStatus(int statusCode, String reasonPhrase)
Creates a new instance with the specified status code and its reason phrase. -
Method Summary
Modifier and Type Method Description int
code()
Returns the code of thisHttpStatus
.String
codeAsText()
Returns the status code asString
.HttpStatusClass
codeClass()
Returns the class of thisHttpStatus
.int
compareTo(HttpStatus o)
Compares this status to the specified status.boolean
equals(Object o)
Returns whether the specified object is "equal to" this status.int
hashCode()
boolean
isClientError()
Returns whether theHttpStatus
is a client error, with a status code of 4XX.boolean
isContentAlwaysEmpty()
Returnstrue
if the content of the response for thisHttpStatus
is expected to be always empty (204, 205 and 304 responses.)static boolean
isContentAlwaysEmpty(int statusCode)
Returnstrue
if the content of the response for the specified status code is expected to be always empty (204, 205 and 304 responses.)boolean
isError()
Returns whether theHttpStatus
is an error.boolean
isInformational()
Returns whether theHttpStatus
is an information, with a status code of 1XX.boolean
isRedirection()
Returns whether theHttpStatus
is a redirection, with a status code of 3XX.boolean
isServerError()
Returns whether theHttpStatus
is a server error, with a status code of 5XX.boolean
isSuccess()
Returns whether theHttpStatus
is a success, with a status code of 2XX.String
reasonPhrase()
Returns the reason phrase of thisHttpStatus
.HttpData
toHttpData()
Returns theHttpData
whose content is"<code> <reasonPhrase>"
encoded in UTF-8.String
toString()
static HttpStatus
valueOf(int statusCode)
Returns theHttpStatus
represented by the specified status code.static HttpStatus
valueOf(String statusText)
Returns theHttpStatus
represented by the specified status text.
-
Field Details
-
CONTINUE
100 Continue. -
SWITCHING_PROTOCOLS
101 Switching Protocols. -
PROCESSING
102 Processing (WebDAV, RFC2518). -
OK
200 OK. -
CREATED
201 Created. -
ACCEPTED
202 Accepted. -
NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information (since HTTP/1.1). -
NO_CONTENT
204 No Content. -
RESET_CONTENT
205 Reset Content. -
PARTIAL_CONTENT
206 Partial Content. -
MULTI_STATUS
207 Multi-Status (WebDAV, RFC2518). -
MULTIPLE_CHOICES
300 Multiple Choices. -
MOVED_PERMANENTLY
301 Moved Permanently. -
FOUND
302 Found. -
SEE_OTHER
303 See Other (since HTTP/1.1). -
NOT_MODIFIED
304 Not Modified. -
USE_PROXY
305 Use Proxy (since HTTP/1.1). -
TEMPORARY_REDIRECT
307 Temporary Redirect (since HTTP/1.1). -
BAD_REQUEST
400 Bad Request. -
UNAUTHORIZED
401 Unauthorized. -
PAYMENT_REQUIRED
402 Payment Required. -
FORBIDDEN
403 Forbidden. -
NOT_FOUND
404 Not Found. -
METHOD_NOT_ALLOWED
405 Method Not Allowed. -
NOT_ACCEPTABLE
406 Not Acceptable. -
PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required. -
REQUEST_TIMEOUT
408 Request Timeout. -
CONFLICT
409 Conflict. -
GONE
410 Gone. -
LENGTH_REQUIRED
411 Length Required. -
PRECONDITION_FAILED
412 Precondition Failed. -
REQUEST_ENTITY_TOO_LARGE
413 Request Entity Too Large. -
REQUEST_URI_TOO_LONG
414 Request-URI Too Long. -
UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type. -
REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable. -
EXPECTATION_FAILED
417 Expectation Failed. -
MISDIRECTED_REQUEST
421 Misdirected Request.- See Also:
- 421 (Misdirected Request) Status Code
-
UNPROCESSABLE_ENTITY
422 Unprocessable Entity (WebDAV, RFC4918). -
LOCKED
423 Locked (WebDAV, RFC4918). -
FAILED_DEPENDENCY
424 Failed Dependency (WebDAV, RFC4918). -
UNORDERED_COLLECTION
425 Unordered Collection (WebDAV, RFC3648). -
UPGRADE_REQUIRED
426 Upgrade Required (RFC2817). -
PRECONDITION_REQUIRED
428 Precondition Required (RFC6585). -
TOO_MANY_REQUESTS
429 Too Many Requests (RFC6585). -
REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large (RFC6585). -
CLIENT_CLOSED_REQUEST
499 Client Closed Request.- See Also:
- 499 CLIENT CLOSED REQUEST
-
INTERNAL_SERVER_ERROR
500 Internal Server Error. -
NOT_IMPLEMENTED
501 Not Implemented. -
BAD_GATEWAY
502 Bad Gateway. -
SERVICE_UNAVAILABLE
503 Service Unavailable. -
GATEWAY_TIMEOUT
504 Gateway Timeout. -
HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported. -
VARIANT_ALSO_NEGOTIATES
506 Variant Also Negotiates (RFC2295). -
INSUFFICIENT_STORAGE
507 Insufficient Storage (WebDAV, RFC4918). -
NOT_EXTENDED
510 Not Extended (RFC2774). -
NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required (RFC6585). -
UNKNOWN
A special status code '0' which represents that the response status is unknown.
-
-
Constructor Details
-
HttpStatus
Creates a new instance with the specified status code and its reason phrase.
-
-
Method Details
-
valueOf
Returns theHttpStatus
represented by the specified status code. -
valueOf
Returns theHttpStatus
represented by the specified status text.- Returns:
- the parsed
HttpStatus
, orUNKNOWN
if failed to parse. - See Also:
isContentAlwaysEmpty()
-
isContentAlwaysEmpty
public static boolean isContentAlwaysEmpty(int statusCode)Returnstrue
if the content of the response for the specified status code is expected to be always empty (204, 205 and 304 responses.) -
code
public int code()Returns the code of thisHttpStatus
. -
codeAsText
Returns the status code asString
. -
reasonPhrase
Returns the reason phrase of thisHttpStatus
. -
codeClass
Returns the class of thisHttpStatus
. -
toHttpData
-
isContentAlwaysEmpty
public boolean isContentAlwaysEmpty()Returnstrue
if the content of the response for thisHttpStatus
is expected to be always empty (204, 205 and 304 responses.)- See Also:
isContentAlwaysEmpty(int)
-
isInformational
public boolean isInformational()Returns whether theHttpStatus
is an information, with a status code of 1XX. -
isSuccess
public boolean isSuccess()Returns whether theHttpStatus
is a success, with a status code of 2XX. -
isRedirection
public boolean isRedirection()Returns whether theHttpStatus
is a redirection, with a status code of 3XX. -
isClientError
public boolean isClientError()Returns whether theHttpStatus
is a client error, with a status code of 4XX. -
isServerError
public boolean isServerError()Returns whether theHttpStatus
is a server error, with a status code of 5XX. -
isError
public boolean isError()Returns whether theHttpStatus
is an error. -
hashCode
public int hashCode() -
equals
Returns whether the specified object is "equal to" this status.Equality of
HttpStatus
only depends oncode()
. The reason phrase is not considered for equality. -
compareTo
Compares this status to the specified status.Equality of
HttpStatus
only depends oncode()
. The reason phrase is not considered for equality.- Specified by:
compareTo
in interfaceComparable<HttpStatus>
-
toString
-