枚举 HttpStatus
- java.lang.Object
- java.lang.Enum<HttpStatus>
- org.springframework.http.HttpStatus
- 所有已实现的接口:
Serializable
,Comparable<HttpStatus>
public enum HttpStatus extends Enum<HttpStatus>
Enumeration of HTTP status codes.The HTTP status code series can be retrieved via
series()
.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Brian Clozel
- 另请参阅:
HttpStatus.Series
, HTTP Status Code Registry, List of HTTP status codes - Wikipedia
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
HttpStatus.Series
Enumeration of HTTP status series.
枚举常量概要
枚举常量 枚举常量 说明 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
已过时。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
已过时。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
已过时。METHOD_NOT_ALLOWED
405 Method Not Allowed
.MOVED_PERMANENTLY
301 Moved Permanently
.MOVED_TEMPORARILY
已过时。in favor ofFOUND
which will be returned fromHttpStatus.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
已过时。in favor ofPAYLOAD_TOO_LARGE
which will be returned fromHttpStatus.valueOf(413)
REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large
.REQUEST_TIMEOUT
408 Request Timeout
.REQUEST_URI_TOO_LONG
已过时。in favor ofURI_TOO_LONG
which will be returned fromHttpStatus.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_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
已过时。due to security concerns regarding in-band configuration of a proxyVARIANT_ALSO_NEGOTIATES
506 Variant Also Negotiates
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 String
getReasonPhrase()
Return the reason phrase of this status code.boolean
is1xxInformational()
Whether this status code is in the HTTP seriesHttpStatus.Series.INFORMATIONAL
.boolean
is2xxSuccessful()
Whether this status code is in the HTTP seriesHttpStatus.Series.SUCCESSFUL
.boolean
is3xxRedirection()
Whether this status code is in the HTTP seriesHttpStatus.Series.REDIRECTION
.boolean
is4xxClientError()
Whether this status code is in the HTTP seriesHttpStatus.Series.CLIENT_ERROR
.boolean
is5xxServerError()
Whether this status code is in the HTTP seriesHttpStatus.Series.SERVER_ERROR
.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 enum constant of this type with the specified numeric value.static HttpStatus
valueOf(String name)
返回带有指定名称的该类型的枚举常量。static HttpStatus[]
values()
按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。
枚举常量详细资料
CONTINUE
public static final HttpStatus CONTINUE
100 Continue
.
SWITCHING_PROTOCOLS
public static final HttpStatus SWITCHING_PROTOCOLS
101 Switching Protocols
.
PROCESSING
public static final HttpStatus PROCESSING
102 Processing
.- 另请参阅:
- WebDAV
CHECKPOINT
public static final HttpStatus CHECKPOINT
103 Checkpoint
.
OK
public static final HttpStatus OK
200 OK
.
CREATED
public static final HttpStatus CREATED
201 Created
.
ACCEPTED
public static final HttpStatus ACCEPTED
202 Accepted
.
NON_AUTHORITATIVE_INFORMATION
public static final HttpStatus NON_AUTHORITATIVE_INFORMATION
203 Non-Authoritative Information
.
NO_CONTENT
public static final HttpStatus NO_CONTENT
204 No Content
.
RESET_CONTENT
public static final HttpStatus RESET_CONTENT
205 Reset Content
.
PARTIAL_CONTENT
public static final HttpStatus PARTIAL_CONTENT
206 Partial Content
.
MULTI_STATUS
public static final HttpStatus MULTI_STATUS
207 Multi-Status
.- 另请参阅:
- WebDAV
ALREADY_REPORTED
public static final HttpStatus ALREADY_REPORTED
208 Already Reported
.
IM_USED
public static final HttpStatus IM_USED
226 IM Used
.
MULTIPLE_CHOICES
public static final HttpStatus MULTIPLE_CHOICES
300 Multiple Choices
.
MOVED_PERMANENTLY
public static final HttpStatus MOVED_PERMANENTLY
301 Moved Permanently
.
FOUND
public static final HttpStatus FOUND
302 Found
.
MOVED_TEMPORARILY
@Deprecated public static final HttpStatus MOVED_TEMPORARILY
已过时。in favor ofFOUND
which will be returned fromHttpStatus.valueOf(302)
302 Moved Temporarily
.
SEE_OTHER
public static final HttpStatus SEE_OTHER
303 See Other
.
NOT_MODIFIED
public static final HttpStatus NOT_MODIFIED
304 Not Modified
.
USE_PROXY
@Deprecated public static final HttpStatus USE_PROXY
已过时。due to security concerns regarding in-band configuration of a proxy305 Use Proxy
.
TEMPORARY_REDIRECT
public static final HttpStatus TEMPORARY_REDIRECT
307 Temporary Redirect
.
PERMANENT_REDIRECT
public static final HttpStatus PERMANENT_REDIRECT
308 Permanent Redirect
.- 另请参阅:
- RFC 7238
BAD_REQUEST
public static final HttpStatus BAD_REQUEST
400 Bad Request
.
UNAUTHORIZED
public static final HttpStatus UNAUTHORIZED
401 Unauthorized
.
PAYMENT_REQUIRED
public static final HttpStatus PAYMENT_REQUIRED
402 Payment Required
.
FORBIDDEN
public static final HttpStatus FORBIDDEN
403 Forbidden
.
NOT_FOUND
public static final HttpStatus NOT_FOUND
404 Not Found
.
METHOD_NOT_ALLOWED
public static final HttpStatus METHOD_NOT_ALLOWED
405 Method Not Allowed
.
NOT_ACCEPTABLE
public static final HttpStatus NOT_ACCEPTABLE
406 Not Acceptable
.
PROXY_AUTHENTICATION_REQUIRED
public static final HttpStatus PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required
.
REQUEST_TIMEOUT
public static final HttpStatus REQUEST_TIMEOUT
408 Request Timeout
.
CONFLICT
public static final HttpStatus CONFLICT
409 Conflict
.
GONE
public static final HttpStatus GONE
410 Gone
.
LENGTH_REQUIRED
public static final HttpStatus LENGTH_REQUIRED
411 Length Required
.
PRECONDITION_FAILED
public static final HttpStatus PRECONDITION_FAILED
412 Precondition failed
.
PAYLOAD_TOO_LARGE
public static final HttpStatus PAYLOAD_TOO_LARGE
413 Payload Too Large
.- 从以下版本开始:
- 4.1
- 另请参阅:
- HTTP/1.1: Semantics and Content, section 6.5.11
REQUEST_ENTITY_TOO_LARGE
@Deprecated public static final HttpStatus REQUEST_ENTITY_TOO_LARGE
已过时。in favor ofPAYLOAD_TOO_LARGE
which will be returned fromHttpStatus.valueOf(413)
413 Request Entity Too Large
.
URI_TOO_LONG
public static final HttpStatus URI_TOO_LONG
414 URI Too Long
.- 从以下版本开始:
- 4.1
- 另请参阅:
- HTTP/1.1: Semantics and Content, section 6.5.12
REQUEST_URI_TOO_LONG
@Deprecated public static final HttpStatus REQUEST_URI_TOO_LONG
已过时。in favor ofURI_TOO_LONG
which will be returned fromHttpStatus.valueOf(414)
414 Request-URI Too Long
.
UNSUPPORTED_MEDIA_TYPE
public static final HttpStatus UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type
.
REQUESTED_RANGE_NOT_SATISFIABLE
public static final HttpStatus REQUESTED_RANGE_NOT_SATISFIABLE
416 Requested Range Not Satisfiable
.
EXPECTATION_FAILED
public static final HttpStatus EXPECTATION_FAILED
417 Expectation Failed
.
I_AM_A_TEAPOT
public static final HttpStatus I_AM_A_TEAPOT
418 I'm a teapot
.- 另请参阅:
- HTCPCP/1.0
INSUFFICIENT_SPACE_ON_RESOURCE
@Deprecated public static final HttpStatus INSUFFICIENT_SPACE_ON_RESOURCE
已过时。
METHOD_FAILURE
@Deprecated public static final HttpStatus METHOD_FAILURE
已过时。
DESTINATION_LOCKED
@Deprecated public static final HttpStatus DESTINATION_LOCKED
已过时。
UNPROCESSABLE_ENTITY
public static final HttpStatus UNPROCESSABLE_ENTITY
422 Unprocessable Entity
.- 另请参阅:
- WebDAV
LOCKED
public static final HttpStatus LOCKED
423 Locked
.- 另请参阅:
- WebDAV
FAILED_DEPENDENCY
public static final HttpStatus FAILED_DEPENDENCY
424 Failed Dependency
.- 另请参阅:
- WebDAV
UPGRADE_REQUIRED
public static final HttpStatus UPGRADE_REQUIRED
426 Upgrade Required
.
PRECONDITION_REQUIRED
public static final HttpStatus PRECONDITION_REQUIRED
428 Precondition Required
.
TOO_MANY_REQUESTS
public static final HttpStatus TOO_MANY_REQUESTS
429 Too Many Requests
.
REQUEST_HEADER_FIELDS_TOO_LARGE
public static final HttpStatus REQUEST_HEADER_FIELDS_TOO_LARGE
431 Request Header Fields Too Large
.
UNAVAILABLE_FOR_LEGAL_REASONS
public static final HttpStatus UNAVAILABLE_FOR_LEGAL_REASONS
451 Unavailable For Legal Reasons
.- 从以下版本开始:
- 4.3
- 另请参阅:
- An HTTP Status Code to Report Legal Obstacles
INTERNAL_SERVER_ERROR
public static final HttpStatus INTERNAL_SERVER_ERROR
500 Internal Server Error
.
NOT_IMPLEMENTED
public static final HttpStatus NOT_IMPLEMENTED
501 Not Implemented
.
BAD_GATEWAY
public static final HttpStatus BAD_GATEWAY
502 Bad Gateway
.
SERVICE_UNAVAILABLE
public static final HttpStatus SERVICE_UNAVAILABLE
503 Service Unavailable
.
GATEWAY_TIMEOUT
public static final HttpStatus GATEWAY_TIMEOUT
504 Gateway Timeout
.
HTTP_VERSION_NOT_SUPPORTED
public static final HttpStatus HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported
.
VARIANT_ALSO_NEGOTIATES
public static final HttpStatus VARIANT_ALSO_NEGOTIATES
506 Variant Also Negotiates
INSUFFICIENT_STORAGE
public static final HttpStatus INSUFFICIENT_STORAGE
507 Insufficient Storage
- 另请参阅:
- WebDAV
LOOP_DETECTED
public static final HttpStatus LOOP_DETECTED
508 Loop Detected
BANDWIDTH_LIMIT_EXCEEDED
public static final HttpStatus BANDWIDTH_LIMIT_EXCEEDED
509 Bandwidth Limit Exceeded
NOT_EXTENDED
public static final HttpStatus NOT_EXTENDED
510 Not Extended
NETWORK_AUTHENTICATION_REQUIRED
public static final HttpStatus NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required
.
方法详细资料
values
public static HttpStatus[] values()
按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。该方法可用于迭代 常量, 如下所示:for (HttpStatus c : HttpStatus.values()) System.out.println(c);
- 返回:
- 按照声明该枚举类型的常量的顺序返回的包含这些常量的数组
valueOf
public static HttpStatus valueOf(String name)
返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name
- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException
- 如果该枚举类型没有带有指定名称的常量NullPointerException
- 如果参数为空值
value
public int value()
Return the integer value of this status code.
getReasonPhrase
public String getReasonPhrase()
Return the reason phrase of this status code.
series
public HttpStatus.Series series()
Return the HTTP status series of this status code.- 另请参阅:
HttpStatus.Series
is1xxInformational
public boolean is1xxInformational()
Whether this status code is in the HTTP seriesHttpStatus.Series.INFORMATIONAL
. This is a shortcut for checking the value ofseries()
.- 从以下版本开始:
- 4.0
- 另请参阅:
series()
is2xxSuccessful
public boolean is2xxSuccessful()
Whether this status code is in the HTTP seriesHttpStatus.Series.SUCCESSFUL
. This is a shortcut for checking the value ofseries()
.- 从以下版本开始:
- 4.0
- 另请参阅:
series()
is3xxRedirection
public boolean is3xxRedirection()
Whether this status code is in the HTTP seriesHttpStatus.Series.REDIRECTION
. This is a shortcut for checking the value ofseries()
.- 从以下版本开始:
- 4.0
- 另请参阅:
series()
is4xxClientError
public boolean is4xxClientError()
Whether this status code is in the HTTP seriesHttpStatus.Series.CLIENT_ERROR
. This is a shortcut for checking the value ofseries()
.- 从以下版本开始:
- 4.0
- 另请参阅:
series()
is5xxServerError
public boolean is5xxServerError()
Whether this status code is in the HTTP seriesHttpStatus.Series.SERVER_ERROR
. This is a shortcut for checking the value ofseries()
.- 从以下版本开始:
- 4.0
- 另请参阅:
series()
toString
public String toString()
Return a string representation of this status code.- 覆盖:
toString
在类中Enum<HttpStatus>
valueOf
public static HttpStatus valueOf(int statusCode)
Return the enum constant of this type with the specified numeric value.- 参数:
statusCode
- the numeric value of the enum to be returned- 返回:
- the enum constant with the specified numeric value
- 抛出:
IllegalArgumentException
- if this enum has no constant for the specified numeric value