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 SummaryNested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of HTTP status series.Nested classes/interfaces inherited from class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum ConstantsEnum ConstantDescription202 Accepted.208 Already Reported.502 Bad Gateway.400 Bad Request.509 Bandwidth Limit ExceededDeprecated.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 Storage500 Internal Server Error.411 Length Required.423 Locked.508 Loop DetectedDeprecated.405 Method Not Allowed.301 Moved Permanently.Deprecated.in favor ofFOUNDwhich 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 Extended404 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_LARGEwhich will be returned fromHttpStatus.valueOf(413)431 Request Header Fields Too Large.408 Request Timeout.Deprecated.in favor ofURI_TOO_LONGwhich 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 SummaryModifier and TypeMethodDescriptionReturn the reason phrase of this status code.booleanWhether this status code is in the Informational class (1xx).booleanWhether this status code is in the Successful class (2xx).booleanWhether this status code is in the Redirection class (3xx).booleanWhether this status code is in the Client Error class (4xx).booleanWhether this status code is in the Server Error class (5xx).booleanisError()Whether this status code is in the Client or Server Error classstatic HttpStatusresolve(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.intvalue()Return the integer value of this status code.static HttpStatusvalueOf(int statusCode) Return theHttpStatusenum constant with the specified numeric value.static HttpStatusReturns 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.Enumclone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfMethods inherited from interface org.springframework.http.HttpStatusCodeisSameCodeAs
- 
Enum Constant Details- 
CONTINUE100 Continue.
- 
SWITCHING_PROTOCOLS101 Switching Protocols.
- 
PROCESSING102 Processing.- See Also:
 
- 
EARLY_HINTS103 Early Hints.- Since:
- 6.0.5
- See Also:
 
- 
CHECKPOINTDeprecated.in favor ofEARLY_HINTSwhich will be returned fromHttpStatus.valueOf(103)103 Checkpoint.
- 
OK200 OK.
- 
CREATED201 Created.
- 
ACCEPTED202 Accepted.
- 
NON_AUTHORITATIVE_INFORMATION203 Non-Authoritative Information.
- 
NO_CONTENT204 No Content.
- 
RESET_CONTENT205 Reset Content.
- 
PARTIAL_CONTENT206 Partial Content.- See Also:
 
- 
MULTI_STATUS207 Multi-Status.- See Also:
 
- 
ALREADY_REPORTED208 Already Reported.- See Also:
 
- 
IM_USED226 IM Used.- See Also:
 
- 
MULTIPLE_CHOICES300 Multiple Choices.
- 
MOVED_PERMANENTLY301 Moved Permanently.
- 
FOUND302 Found.
- 
MOVED_TEMPORARILYDeprecated.in favor ofFOUNDwhich will be returned fromHttpStatus.valueOf(302)302 Moved Temporarily.- See Also:
 
- 
SEE_OTHER303 See Other.
- 
NOT_MODIFIED304 Not Modified.
- 
USE_PROXYDeprecated.due to security concerns regarding in-band configuration of a proxy305 Use Proxy.
- 
TEMPORARY_REDIRECT307 Temporary Redirect.
- 
PERMANENT_REDIRECT308 Permanent Redirect.- See Also:
 
- 
BAD_REQUEST400 Bad Request.
- 
UNAUTHORIZED401 Unauthorized.- See Also:
 
- 
PAYMENT_REQUIRED402 Payment Required.
- 
FORBIDDEN403 Forbidden.
- 
NOT_FOUND404 Not Found.
- 
METHOD_NOT_ALLOWED405 Method Not Allowed.
- 
NOT_ACCEPTABLE406 Not Acceptable.
- 
PROXY_AUTHENTICATION_REQUIRED407 Proxy Authentication Required.- See Also:
 
- 
REQUEST_TIMEOUT408 Request Timeout.
- 
CONFLICT409 Conflict.
- 
GONE410 Gone.
- 
LENGTH_REQUIRED411 Length Required.
- 
PRECONDITION_FAILED412 Precondition failed.
- 
PAYLOAD_TOO_LARGE413 Payload Too Large.- Since:
- 4.1
- See Also:
 
- 
REQUEST_ENTITY_TOO_LARGEDeprecated.in favor ofPAYLOAD_TOO_LARGEwhich will be returned fromHttpStatus.valueOf(413)413 Request Entity Too Large.- See Also:
 
- 
URI_TOO_LONG414 URI Too Long.- Since:
- 4.1
- See Also:
 
- 
REQUEST_URI_TOO_LONGDeprecated.in favor ofURI_TOO_LONGwhich will be returned fromHttpStatus.valueOf(414)414 Request-URI Too Long.- See Also:
 
- 
UNSUPPORTED_MEDIA_TYPE415 Unsupported Media Type.
- 
REQUESTED_RANGE_NOT_SATISFIABLE416 Requested Range Not Satisfiable.- See Also:
 
- 
EXPECTATION_FAILED417 Expectation Failed.
- 
I_AM_A_TEAPOT418 I'm a teapot.- See Also:
 
- 
INSUFFICIENT_SPACE_ON_RESOURCEDeprecated.
- 
METHOD_FAILUREDeprecated.
- 
DESTINATION_LOCKEDDeprecated.
- 
UNPROCESSABLE_ENTITY422 Unprocessable Entity.- See Also:
 
- 
LOCKED423 Locked.- See Also:
 
- 
FAILED_DEPENDENCY424 Failed Dependency.- See Also:
 
- 
TOO_EARLY425 Too Early.- Since:
- 5.2
- See Also:
 
- 
UPGRADE_REQUIRED426 Upgrade Required.- See Also:
 
- 
PRECONDITION_REQUIRED428 Precondition Required.- See Also:
 
- 
TOO_MANY_REQUESTS429 Too Many Requests.- See Also:
 
- 
REQUEST_HEADER_FIELDS_TOO_LARGE431 Request Header Fields Too Large.- See Also:
 
- 
UNAVAILABLE_FOR_LEGAL_REASONS451 Unavailable For Legal Reasons.- Since:
- 4.3
- See Also:
 
- 
INTERNAL_SERVER_ERROR500 Internal Server Error.
- 
NOT_IMPLEMENTED501 Not Implemented.
- 
BAD_GATEWAY502 Bad Gateway.
- 
SERVICE_UNAVAILABLE503 Service Unavailable.
- 
GATEWAY_TIMEOUT504 Gateway Timeout.
- 
HTTP_VERSION_NOT_SUPPORTED505 HTTP Version Not Supported.
- 
VARIANT_ALSO_NEGOTIATES506 Variant Also Negotiates- See Also:
 
- 
INSUFFICIENT_STORAGE507 Insufficient Storage- See Also:
 
- 
LOOP_DETECTED508 Loop Detected- See Also:
 
- 
BANDWIDTH_LIMIT_EXCEEDED509 Bandwidth Limit Exceeded
- 
NOT_EXTENDED510 Not Extended- See Also:
 
- 
NETWORK_AUTHENTICATION_REQUIRED511 Network Authentication Required.- See Also:
 
 
- 
- 
Method Details- 
valuesReturns 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
 
- 
valueOfReturns 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 name
- NullPointerException- if the argument is null
 
- 
valuepublic int value()Description copied from interface:HttpStatusCodeReturn the integer value of this status code.- Specified by:
- valuein interface- HttpStatusCode
 
- 
seriesReturn the HTTP status series of this status code.- See Also:
 
- 
getReasonPhraseReturn the reason phrase of this status code.
- 
is1xxInformationalpublic boolean is1xxInformational()Description copied from interface:HttpStatusCodeWhether this status code is in the Informational class (1xx).- Specified by:
- is1xxInformationalin interface- HttpStatusCode
- See Also:
 
- 
is2xxSuccessfulpublic boolean is2xxSuccessful()Description copied from interface:HttpStatusCodeWhether this status code is in the Successful class (2xx).- Specified by:
- is2xxSuccessfulin interface- HttpStatusCode
- See Also:
 
- 
is3xxRedirectionpublic boolean is3xxRedirection()Description copied from interface:HttpStatusCodeWhether this status code is in the Redirection class (3xx).- Specified by:
- is3xxRedirectionin interface- HttpStatusCode
- See Also:
 
- 
is4xxClientErrorpublic boolean is4xxClientError()Description copied from interface:HttpStatusCodeWhether this status code is in the Client Error class (4xx).- Specified by:
- is4xxClientErrorin interface- HttpStatusCode
- See Also:
 
- 
is5xxServerErrorpublic boolean is5xxServerError()Description copied from interface:HttpStatusCodeWhether this status code is in the Server Error class (5xx).- Specified by:
- is5xxServerErrorin interface- HttpStatusCode
- See Also:
 
- 
isErrorpublic boolean isError()Description copied from interface:HttpStatusCodeWhether this status code is in the Client or Server Error class- Specified by:
- isErrorin interface- HttpStatusCode
- See Also:
 
- 
toStringReturn a string representation of this status code.- Overrides:
- toStringin class- Enum<HttpStatus>
 
- 
valueOfReturn theHttpStatusenum 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
 
- 
resolveResolve the given status code to anHttpStatus, if possible.- Parameters:
- statusCode- the HTTP status code (potentially non-standard)
- Returns:
- the corresponding HttpStatus, ornullif not found
- Since:
- 5.0
 
 
- 
EARLY_HINTSwhich will be returned fromHttpStatus.valueOf(103)