public enum HttpStatus extends Enum<HttpStatus>
The HTTP status code series can be retrieved via series()
.
HttpStatus.Series
,
HTTP Status Code Registry,
List of HTTP status codes - WikipediaModifier and Type | Class and Description |
---|---|
static class |
HttpStatus.Series
Enumeration of HTTP status series.
|
Enum Constant and Description |
---|
ACCEPTED
202 Accepted . |
ALREADY_REPORTED
208 Already Reported . |
BAD_GATEWAY
502 Bad Gateway . |
BAD_REQUEST
400 Bad Request . |
BANDWIDTH_LIMIT_EXCEEDED
509 Bandwidth Limit Exceeded |
CHECKPOINT
103 Checkpoint . |
CONFLICT
409 Conflict . |
CONTINUE
100 Continue . |
CREATED
201 Created . |
DESTINATION_LOCKED
Deprecated.
|
EXPECTATION_FAILED
417 Expectation Failed . |
FAILED_DEPENDENCY
424 Failed Dependency . |
FORBIDDEN
403 Forbidden . |
FOUND
302 Found . |
GATEWAY_TIMEOUT
504 Gateway Timeout . |
GONE
410 Gone . |
HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported . |
I_AM_A_TEAPOT
418 I'm a teapot . |
IM_USED
226 IM Used . |
INSUFFICIENT_SPACE_ON_RESOURCE
Deprecated.
|
INSUFFICIENT_STORAGE
507 Insufficient Storage |
INTERNAL_SERVER_ERROR
500 Internal Server Error . |
LENGTH_REQUIRED
411 Length Required . |
LOCKED
423 Locked . |
LOOP_DETECTED
508 Loop Detected |
METHOD_FAILURE
Deprecated.
|
METHOD_NOT_ALLOWED
405 Method Not Allowed . |
MOVED_PERMANENTLY
301 Moved Permanently . |
MOVED_TEMPORARILY
Deprecated.
in favor of
FOUND which will be returned from HttpStatus.valueOf(302) |
MULTI_STATUS
207 Multi-Status . |
MULTIPLE_CHOICES
300 Multiple Choices . |
NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required . |
NO_CONTENT
204 No Content . |
NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information . |
NOT_ACCEPTABLE
406 Not Acceptable . |
NOT_EXTENDED
510 Not Extended |
NOT_FOUND
404 Not Found . |
NOT_IMPLEMENTED
501 Not Implemented . |
NOT_MODIFIED
304 Not Modified . |
OK
200 OK . |
PARTIAL_CONTENT
206 Partial Content . |
PAYLOAD_TOO_LARGE
413 Payload Too Large . |
PAYMENT_REQUIRED
402 Payment Required . |
PERMANENT_REDIRECT
308 Permanent Redirect . |
PRECONDITION_FAILED
412 Precondition failed . |
PRECONDITION_REQUIRED
428 Precondition Required . |
PROCESSING
102 Processing . |
PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required . |
REQUEST_ENTITY_TOO_LARGE
Deprecated.
in favor of
PAYLOAD_TOO_LARGE which will be
returned from HttpStatus.valueOf(413) |
REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large . |
REQUEST_TIMEOUT
408 Request Timeout . |
REQUEST_URI_TOO_LONG
Deprecated.
in favor of
URI_TOO_LONG which will be returned from HttpStatus.valueOf(414) |
REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable . |
RESET_CONTENT
205 Reset Content . |
SEE_OTHER
303 See Other . |
SERVICE_UNAVAILABLE
503 Service Unavailable . |
SWITCHING_PROTOCOLS
101 Switching Protocols . |
TEMPORARY_REDIRECT
307 Temporary Redirect . |
TOO_EARLY
425 Too Early . |
TOO_MANY_REQUESTS
429 Too Many Requests . |
UNAUTHORIZED
401 Unauthorized . |
UNAVAILABLE_FOR_LEGAL_REASONS
451 Unavailable For Legal Reasons . |
UNPROCESSABLE_ENTITY
422 Unprocessable Entity . |
UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type . |
UPGRADE_REQUIRED
426 Upgrade Required . |
URI_TOO_LONG
414 URI Too Long . |
USE_PROXY
Deprecated.
due to security concerns regarding in-band configuration of a proxy
|
VARIANT_ALSO_NEGOTIATES
506 Variant Also Negotiates |
Modifier and Type | Method and Description |
---|---|
String |
getReasonPhrase()
Return the reason phrase of this status code.
|
boolean |
is1xxInformational()
Whether this status code is in the HTTP series
HttpStatus.Series.INFORMATIONAL . |
boolean |
is2xxSuccessful()
Whether this status code is in the HTTP series
HttpStatus.Series.SUCCESSFUL . |
boolean |
is3xxRedirection()
Whether this status code is in the HTTP series
HttpStatus.Series.REDIRECTION . |
boolean |
is4xxClientError()
Whether this status code is in the HTTP series
HttpStatus.Series.CLIENT_ERROR . |
boolean |
is5xxServerError()
Whether this status code is in the HTTP series
HttpStatus.Series.SERVER_ERROR . |
boolean |
isError()
Whether this status code is in the HTTP series
HttpStatus.Series.CLIENT_ERROR or
HttpStatus.Series.SERVER_ERROR . |
static HttpStatus |
resolve(int statusCode)
Resolve the given status code to an
HttpStatus , if possible. |
HttpStatus.Series |
series()
Return the HTTP status series of this status code.
|
String |
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 the
HttpStatus enum constant with the specified numeric value. |
static HttpStatus |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static HttpStatus[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final HttpStatus CONTINUE
100 Continue
.public static final HttpStatus SWITCHING_PROTOCOLS
101 Switching Protocols
.public static final HttpStatus PROCESSING
102 Processing
.public static final HttpStatus CHECKPOINT
103 Checkpoint
.public static final HttpStatus OK
200 OK
.public static final HttpStatus CREATED
201 Created
.public static final HttpStatus ACCEPTED
202 Accepted
.public static final HttpStatus NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information
.public static final HttpStatus NO_CONTENT
204 No Content
.public static final HttpStatus RESET_CONTENT
205 Reset Content
.public static final HttpStatus PARTIAL_CONTENT
206 Partial Content
.public static final HttpStatus MULTI_STATUS
207 Multi-Status
.public static final HttpStatus ALREADY_REPORTED
208 Already Reported
.public static final HttpStatus IM_USED
226 IM Used
.public static final HttpStatus MULTIPLE_CHOICES
300 Multiple Choices
.public static final HttpStatus MOVED_PERMANENTLY
301 Moved Permanently
.public static final HttpStatus FOUND
302 Found
.@Deprecated public static final HttpStatus MOVED_TEMPORARILY
FOUND
which will be returned from HttpStatus.valueOf(302)
302 Moved Temporarily
.public static final HttpStatus SEE_OTHER
303 See Other
.public static final HttpStatus NOT_MODIFIED
304 Not Modified
.@Deprecated public static final HttpStatus USE_PROXY
305 Use Proxy
.public static final HttpStatus TEMPORARY_REDIRECT
307 Temporary Redirect
.public static final HttpStatus PERMANENT_REDIRECT
308 Permanent Redirect
.public static final HttpStatus BAD_REQUEST
400 Bad Request
.public static final HttpStatus UNAUTHORIZED
401 Unauthorized
.public static final HttpStatus PAYMENT_REQUIRED
402 Payment Required
.public static final HttpStatus FORBIDDEN
403 Forbidden
.public static final HttpStatus NOT_FOUND
404 Not Found
.public static final HttpStatus METHOD_NOT_ALLOWED
405 Method Not Allowed
.public static final HttpStatus NOT_ACCEPTABLE
406 Not Acceptable
.public static final HttpStatus PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required
.public static final HttpStatus REQUEST_TIMEOUT
408 Request Timeout
.public static final HttpStatus CONFLICT
409 Conflict
.public static final HttpStatus GONE
410 Gone
.public static final HttpStatus LENGTH_REQUIRED
411 Length Required
.public static final HttpStatus PRECONDITION_FAILED
412 Precondition failed
.public static final HttpStatus PAYLOAD_TOO_LARGE
413 Payload Too Large
.@Deprecated public static final HttpStatus REQUEST_ENTITY_TOO_LARGE
PAYLOAD_TOO_LARGE
which will be
returned from HttpStatus.valueOf(413)
413 Request Entity Too Large
.public static final HttpStatus URI_TOO_LONG
414 URI Too Long
.@Deprecated public static final HttpStatus REQUEST_URI_TOO_LONG
URI_TOO_LONG
which will be returned from HttpStatus.valueOf(414)
414 Request-URI Too Long
.public static final HttpStatus UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type
.public static final HttpStatus REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable
.public static final HttpStatus EXPECTATION_FAILED
417 Expectation Failed
.public static final HttpStatus I_AM_A_TEAPOT
418 I'm a teapot
.@Deprecated public static final HttpStatus INSUFFICIENT_SPACE_ON_RESOURCE
@Deprecated public static final HttpStatus METHOD_FAILURE
@Deprecated public static final HttpStatus DESTINATION_LOCKED
public static final HttpStatus UNPROCESSABLE_ENTITY
422 Unprocessable Entity
.public static final HttpStatus LOCKED
423 Locked
.public static final HttpStatus FAILED_DEPENDENCY
424 Failed Dependency
.public static final HttpStatus TOO_EARLY
425 Too Early
.public static final HttpStatus UPGRADE_REQUIRED
426 Upgrade Required
.public static final HttpStatus PRECONDITION_REQUIRED
428 Precondition Required
.public static final HttpStatus TOO_MANY_REQUESTS
429 Too Many Requests
.public static final HttpStatus REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large
.public static final HttpStatus UNAVAILABLE_FOR_LEGAL_REASONS
451 Unavailable For Legal Reasons
.public static final HttpStatus INTERNAL_SERVER_ERROR
500 Internal Server Error
.public static final HttpStatus NOT_IMPLEMENTED
501 Not Implemented
.public static final HttpStatus BAD_GATEWAY
502 Bad Gateway
.public static final HttpStatus SERVICE_UNAVAILABLE
503 Service Unavailable
.public static final HttpStatus GATEWAY_TIMEOUT
504 Gateway Timeout
.public static final HttpStatus HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported
.public static final HttpStatus VARIANT_ALSO_NEGOTIATES
506 Variant Also Negotiates
public static final HttpStatus INSUFFICIENT_STORAGE
507 Insufficient Storage
public static final HttpStatus LOOP_DETECTED
508 Loop Detected
public static final HttpStatus BANDWIDTH_LIMIT_EXCEEDED
509 Bandwidth Limit Exceeded
public static final HttpStatus NOT_EXTENDED
510 Not Extended
public static final HttpStatus NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required
.public static HttpStatus[] values()
for (HttpStatus c : HttpStatus.values()) System.out.println(c);
public static HttpStatus valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int value()
public HttpStatus.Series series()
HttpStatus.Series
public String getReasonPhrase()
public boolean is1xxInformational()
HttpStatus.Series.INFORMATIONAL
.
This is a shortcut for checking the value of series()
.
series()
public boolean is2xxSuccessful()
HttpStatus.Series.SUCCESSFUL
.
This is a shortcut for checking the value of series()
.
series()
public boolean is3xxRedirection()
HttpStatus.Series.REDIRECTION
.
This is a shortcut for checking the value of series()
.
series()
public boolean is4xxClientError()
HttpStatus.Series.CLIENT_ERROR
.
This is a shortcut for checking the value of series()
.
series()
public boolean is5xxServerError()
HttpStatus.Series.SERVER_ERROR
.
This is a shortcut for checking the value of series()
.
series()
public boolean isError()
HttpStatus.Series.CLIENT_ERROR
or
HttpStatus.Series.SERVER_ERROR
.
This is a shortcut for checking the value of series()
.
is4xxClientError()
,
is5xxServerError()
public String toString()
toString
in class Enum<HttpStatus>
public static HttpStatus valueOf(int statusCode)
HttpStatus
enum constant with the specified numeric value.statusCode
- the numeric value of the enum to be returnedIllegalArgumentException
- if this enum has no constant for the specified numeric value@Nullable public static HttpStatus resolve(int statusCode)
HttpStatus
, if possible.statusCode
- the HTTP status code (potentially non-standard)HttpStatus
, or null
if not found