Enum HttpStatusCode
- All Implemented Interfaces:
Serializable, Comparable<HttpStatusCode>
Enum of standard HTTP status codes as defined by
IANA HTTP Status Code Registry.
Each constant carries its numeric code, a human-readable
reason phrase, and a HttpStatusCode.Family classification
(1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe available HTTP status code families. -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpStatusCodefromStatusCode(int statusCode) Returns the enum constant for the given status code.Returns the status code family.Returns the reason phrase.intReturns the numeric status code.toString()Returns the reason phrase.static HttpStatusCodeReturns the enum constant of this type with the specified name.static HttpStatusCode[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
OK
-
CREATED
-
ACCEPTED
-
NO_CONTENT
-
RESET_CONTENT
-
PARTIAL_CONTENT
-
MOVED_PERMANENTLY
-
FOUND
-
SEE_OTHER
-
NOT_MODIFIED
-
USE_PROXY
-
TEMPORARY_REDIRECT
-
BAD_REQUEST
-
UNAUTHORIZED
-
PAYMENT_REQUIRED
-
FORBIDDEN
-
NOT_FOUND
-
METHOD_NOT_ALLOWED
-
NOT_ACCEPTABLE
-
PROXY_AUTHENTICATION_REQUIRED
-
REQUEST_TIMEOUT
-
CONFLICT
-
GONE
-
LENGTH_REQUIRED
-
PRECONDITION_FAILED
-
REQUEST_ENTITY_TOO_LARGE
-
REQUEST_URI_TOO_LONG
-
UNSUPPORTED_MEDIA_TYPE
-
REQUESTED_RANGE_NOT_SATISFIABLE
-
EXPECTATION_FAILED
-
PRECONDITION_REQUIRED
-
TOO_MANY_REQUESTS
-
REQUEST_HEADER_FIELDS_TOO_LARGE
-
INTERNAL_SERVER_ERROR
-
NOT_IMPLEMENTED
-
BAD_GATEWAY
-
SERVICE_UNAVAILABLE
-
GATEWAY_TIMEOUT
-
HTTP_VERSION_NOT_SUPPORTED
-
NETWORK_AUTHENTICATION_REQUIRED
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getFamily
Returns the status code family.- Returns:
- the status code family
-
getStatusCode
public int getStatusCode()Returns the numeric status code.- Returns:
- the numeric status code
-
getReasonPhrase
-
toString
Returns the reason phrase.- Overrides:
toStringin classEnum<HttpStatusCode>- Returns:
- the reason phrase
-
fromStatusCode
Returns the enum constant for the given status code.- Parameters:
statusCode- the status code- Returns:
- the matching enum constant, or
nullif none matches
-