Package org.springframework.http
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
Modifier 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 ConstantDescription202 Accepted
.208 Already Reported
.502 Bad Gateway
.400 Bad Request
.509 Bandwidth Limit Exceeded
Deprecated.409 Conflict
.100 Continue
.201 Created
.Deprecated.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
.Deprecated.507 Insufficient Storage
500 Internal Server Error
.411 Length Required
.423 Locked
.508 Loop Detected
Deprecated.405 Method Not Allowed
.301 Moved Permanently
.Deprecated.in favor ofFOUND
which will be returned fromHttpStatus.valueOf(302)
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
.Deprecated.in favor ofPAYLOAD_TOO_LARGE
which will be returned fromHttpStatus.valueOf(413)
431 Request Header Fields Too Large
.408 Request Timeout
.Deprecated.in favor ofURI_TOO_LONG
which will be returned fromHttpStatus.valueOf(414)
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
.Deprecated.due to security concerns regarding in-band configuration of a proxy506 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
100 Continue
. -
SWITCHING_PROTOCOLS
101 Switching Protocols
. -
PROCESSING
102 Processing
.- See Also:
-
EARLY_HINTS
103 Early Hints
.- Since:
- 6.0.5
- See Also:
-
CHECKPOINT
Deprecated.in favor ofEARLY_HINTS
which will be returned fromHttpStatus.valueOf(103)
103 Checkpoint
. -
OK
200 OK
. -
CREATED
201 Created
. -
ACCEPTED
202 Accepted
. -
NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information
. -
NO_CONTENT
204 No Content
. -
RESET_CONTENT
205 Reset Content
. -
PARTIAL_CONTENT
206 Partial Content
.- See Also:
-
MULTI_STATUS
207 Multi-Status
.- See Also:
-
ALREADY_REPORTED
208 Already Reported
.- See Also:
-
IM_USED
226 IM Used
.- See Also:
-
MULTIPLE_CHOICES
300 Multiple Choices
. -
MOVED_PERMANENTLY
301 Moved Permanently
. -
FOUND
302 Found
. -
MOVED_TEMPORARILY
Deprecated.in favor ofFOUND
which will be returned fromHttpStatus.valueOf(302)
302 Moved Temporarily
.- See Also:
-
SEE_OTHER
303 See Other
. -
NOT_MODIFIED
304 Not Modified
. -
USE_PROXY
Deprecated.due to security concerns regarding in-band configuration of a proxy305 Use Proxy
. -
TEMPORARY_REDIRECT
307 Temporary Redirect
. -
PERMANENT_REDIRECT
308 Permanent Redirect
.- See Also:
-
BAD_REQUEST
400 Bad Request
. -
UNAUTHORIZED
401 Unauthorized
.- See Also:
-
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
.- See Also:
-
REQUEST_TIMEOUT
408 Request Timeout
. -
CONFLICT
409 Conflict
. -
GONE
410 Gone
. -
LENGTH_REQUIRED
411 Length Required
. -
PRECONDITION_FAILED
412 Precondition failed
. -
PAYLOAD_TOO_LARGE
413 Payload Too Large
.- Since:
- 4.1
- See Also:
-
REQUEST_ENTITY_TOO_LARGE
Deprecated.in favor ofPAYLOAD_TOO_LARGE
which will be returned fromHttpStatus.valueOf(413)
413 Request Entity Too Large
.- See Also:
-
URI_TOO_LONG
414 URI Too Long
.- Since:
- 4.1
- See Also:
-
REQUEST_URI_TOO_LONG
Deprecated.in favor ofURI_TOO_LONG
which will be returned fromHttpStatus.valueOf(414)
414 Request-URI Too Long
.- See Also:
-
UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type
. -
REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable
.- See Also:
-
EXPECTATION_FAILED
417 Expectation Failed
. -
I_AM_A_TEAPOT
418 I'm a teapot
.- See Also:
-
INSUFFICIENT_SPACE_ON_RESOURCE
Deprecated. -
METHOD_FAILURE
Deprecated. -
DESTINATION_LOCKED
Deprecated. -
UNPROCESSABLE_ENTITY
422 Unprocessable Entity
.- See Also:
-
LOCKED
423 Locked
.- See Also:
-
FAILED_DEPENDENCY
424 Failed Dependency
.- See Also:
-
TOO_EARLY
425 Too Early
.- Since:
- 5.2
- See Also:
-
UPGRADE_REQUIRED
426 Upgrade Required
.- See Also:
-
PRECONDITION_REQUIRED
428 Precondition Required
.- See Also:
-
TOO_MANY_REQUESTS
429 Too Many Requests
.- See Also:
-
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
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
- See Also:
-
INSUFFICIENT_STORAGE
507 Insufficient Storage
- See Also:
-
LOOP_DETECTED
508 Loop Detected
- See Also:
-
BANDWIDTH_LIMIT_EXCEEDED
509 Bandwidth Limit Exceeded
-
NOT_EXTENDED
510 Not Extended
- See Also:
-
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
Return the HTTP status series of this status code.- See Also:
-
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
-
EARLY_HINTS
which will be returned fromHttpStatus.valueOf(103)