Enum Class HttpStatus
- All Implemented Interfaces:
Serializable
,Comparable<HttpStatus>
,Constable
,HttpStatusCode
Enumeration of HTTP status codes.
The HTTP status code series can be retrieved via series()
.
- Since:
- 3.0
- Author:
- Arjen Poutsma, Sebastien Deleuze, Brian Clozel
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of HTTP status series.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescription202 Accepted
.208 Already Reported
.502 Bad Gateway
.400 Bad Request
.509 Bandwidth Limit Exceeded
409 Conflict
.100 Continue
.201 Created
.103 Early Hints
.417 Expectation Failed
.424 Failed Dependency
.403 Forbidden
.302 Found
.504 Gateway Timeout
.410 Gone
.505 HTTP Version Not Supported
.418 I'm a teapot
.226 IM Used
.507 Insufficient Storage
500 Internal Server Error
.411 Length Required
.423 Locked
.508 Loop Detected
405 Method Not Allowed
.301 Moved Permanently
.207 Multi-Status
.300 Multiple Choices
.511 Network Authentication Required
.204 No Content
.203 Non-Authoritative Information
.406 Not Acceptable
.510 Not Extended
404 Not Found
.501 Not Implemented
.304 Not Modified
.200 OK
.206 Partial Content
.413 Payload Too Large
.402 Payment Required
.308 Permanent Redirect
.412 Precondition failed
.428 Precondition Required
.102 Processing
.407 Proxy Authentication Required
.431 Request Header Fields Too Large
.408 Request Timeout
.416 Requested Range Not Satisfiable
.205 Reset Content
.303 See Other
.503 Service Unavailable
.101 Switching Protocols
.307 Temporary Redirect
.425 Too Early
.429 Too Many Requests
.401 Unauthorized
.451 Unavailable For Legal Reasons
.422 Unprocessable Entity
.415 Unsupported Media Type
.426 Upgrade Required
.414 URI Too Long
.506 Variant Also Negotiates
-
Method Summary
Modifier and TypeMethodDescriptionReturn the reason phrase of this status code.boolean
Whether this status code is in the Informational class (1xx
).boolean
Whether this status code is in the Successful class (2xx
).boolean
Whether this status code is in the Redirection class (3xx
).boolean
Whether this status code is in the Client Error class (4xx
).boolean
Whether this status code is in the Server Error class (5xx
).boolean
isError()
Whether this status code is in the Client or Server Error classstatic @Nullable HttpStatus
resolve
(int statusCode) Resolve the given status code to anHttpStatus
, if possible.series()
Return the HTTP status series of this status code.toString()
Return a string representation of this status code.int
value()
Return the integer value of this status code.static HttpStatus
valueOf
(int statusCode) Return theHttpStatus
enum constant with the specified numeric value.static HttpStatus
Returns the enum constant of this class with the specified name.static HttpStatus[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
Methods inherited from interface org.springframework.http.HttpStatusCode
isSameCodeAs
-
Enum Constant Details
-
CONTINUE
-
SWITCHING_PROTOCOLS
-
PROCESSING
-
EARLY_HINTS
-
OK
-
CREATED
-
ACCEPTED
-
NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information
.- See Also:
-
NO_CONTENT
-
RESET_CONTENT
-
PARTIAL_CONTENT
-
MULTI_STATUS
-
ALREADY_REPORTED
-
IM_USED
-
MULTIPLE_CHOICES
-
MOVED_PERMANENTLY
-
FOUND
-
SEE_OTHER
-
NOT_MODIFIED
-
TEMPORARY_REDIRECT
-
PERMANENT_REDIRECT
-
BAD_REQUEST
-
UNAUTHORIZED
-
PAYMENT_REQUIRED
-
FORBIDDEN
-
NOT_FOUND
-
METHOD_NOT_ALLOWED
-
NOT_ACCEPTABLE
-
PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required
.- See Also:
-
REQUEST_TIMEOUT
-
CONFLICT
-
GONE
-
LENGTH_REQUIRED
-
PRECONDITION_FAILED
-
PAYLOAD_TOO_LARGE
-
URI_TOO_LONG
-
UNSUPPORTED_MEDIA_TYPE
-
REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable
.- See Also:
-
EXPECTATION_FAILED
-
I_AM_A_TEAPOT
-
UNPROCESSABLE_ENTITY
-
LOCKED
-
FAILED_DEPENDENCY
-
TOO_EARLY
-
UPGRADE_REQUIRED
-
PRECONDITION_REQUIRED
-
TOO_MANY_REQUESTS
-
REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large
.- See Also:
-
UNAVAILABLE_FOR_LEGAL_REASONS
451 Unavailable For Legal Reasons
.- Since:
- 4.3
- See Also:
-
INTERNAL_SERVER_ERROR
-
NOT_IMPLEMENTED
-
BAD_GATEWAY
-
SERVICE_UNAVAILABLE
-
GATEWAY_TIMEOUT
-
HTTP_VERSION_NOT_SUPPORTED
-
VARIANT_ALSO_NEGOTIATES
-
INSUFFICIENT_STORAGE
-
LOOP_DETECTED
-
BANDWIDTH_LIMIT_EXCEEDED
509 Bandwidth Limit Exceeded
-
NOT_EXTENDED
-
NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required
.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
value
public int value()Description copied from interface:HttpStatusCode
Return the integer value of this status code.- Specified by:
value
in interfaceHttpStatusCode
-
series
-
getReasonPhrase
Return the reason phrase of this status code. -
is1xxInformational
public boolean is1xxInformational()Description copied from interface:HttpStatusCode
Whether this status code is in the Informational class (1xx
).- Specified by:
is1xxInformational
in interfaceHttpStatusCode
- See Also:
-
is2xxSuccessful
public boolean is2xxSuccessful()Description copied from interface:HttpStatusCode
Whether this status code is in the Successful class (2xx
).- Specified by:
is2xxSuccessful
in interfaceHttpStatusCode
- See Also:
-
is3xxRedirection
public boolean is3xxRedirection()Description copied from interface:HttpStatusCode
Whether this status code is in the Redirection class (3xx
).- Specified by:
is3xxRedirection
in interfaceHttpStatusCode
- See Also:
-
is4xxClientError
public boolean is4xxClientError()Description copied from interface:HttpStatusCode
Whether this status code is in the Client Error class (4xx
).- Specified by:
is4xxClientError
in interfaceHttpStatusCode
- See Also:
-
is5xxServerError
public boolean is5xxServerError()Description copied from interface:HttpStatusCode
Whether this status code is in the Server Error class (5xx
).- Specified by:
is5xxServerError
in interfaceHttpStatusCode
- See Also:
-
isError
public boolean isError()Description copied from interface:HttpStatusCode
Whether this status code is in the Client or Server Error class- Specified by:
isError
in interfaceHttpStatusCode
- See Also:
-
toString
Return a string representation of this status code.- Overrides:
toString
in classEnum<HttpStatus>
-
valueOf
Return theHttpStatus
enum constant with the specified numeric value.- Parameters:
statusCode
- the numeric value of the enum to be returned- Returns:
- the enum constant with the specified numeric value
- Throws:
IllegalArgumentException
- if this enum has no constant for the specified numeric value
-
resolve
Resolve the given status code to anHttpStatus
, if possible.- Parameters:
statusCode
- the HTTP status code (potentially non-standard)- Returns:
- the corresponding
HttpStatus
, ornull
if not found - Since:
- 5.0
-