java.lang.Object
io.helidon.http.Status
Commonly used status codes defined by HTTP, see
HTTP/1.1 documentation.
Additional status codes can be added by applications
by call
create(int)
or create(int, String)
with unknown status code, or with text
that differs from the predefined status codes.
Although the constants are instances of this class, they can be compared using instance equality, as the only
way to obtain an instance is through methods create(int)
create(int, String)
, which ensures
the same instance is returned for known status codes and reason phrases.
A good reference is the IANA list of HTTP Status Codes (we may not cover all of them in this type): IANA HTTP Status Codes
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enumeration representing the class of status code. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Status
202 Accepted, see HTTP/1.1 documentation .static final Status
502 Bad Gateway, see HTTP/1.1 documentation.static final Status
400 Bad Request, see HTTP/1.1 documentation.static final Status
409 Conflict, see HTTP/1.1 documentation.static final Status
100 Continue, see HTTP/1.1 documentations.static final Status
201 Created, see HTTP/1.1 documentation.static final Status
417 Expectation Failed, see HTTP/1.1 documentation.static final Status
Failed dependency, see RFC 4918 - HTTP Extensions for WebDAV.static final Status
403 Forbidden, see HTTP/1.1 documentation.static final Status
302 Found, see HTTP/1.1 documentation.static final Status
504 Gateway Timeout, see HTTP/1.1 documentation.static final Status
410 Gone, see HTTP/1.1 documentation.static final Status
505 HTTP Version Not Supported, see HTTP/1.1 documentation.static final Status
418 I'm a teapot, see Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0).static final Status
507 Insufficient Storage, see WebDAV documentation.static final Status
500 Internal Server Error, see HTTP/1.1 documentation.static final Status
411 Length Required, see HTTP/1.1 documentation.static final Status
Locked, see RFC 4918 - HTTP Extensions for WebDAV.static final Status
508 Loop Detected, see RFC 5842 - Bindings for the Constrained Application Protocol (CoAP).static final Status
405 Method Not Allowed, see HTTP/1.1 documentation.static final Status
Misdirected request, see RFC 9110 - Http Semantics.static final Status
301 Moved Permanently, see HTTP/1.1 documentation.static final Status
207 Multi-Status, see RFC 4918 - HTTP Extensions for WebDAV.static final Status
511 Network Authentication Required, see RFC 6585 - Additional HTTP Status Codes.static final Status
204 No Content, see HTTP/1.1 documentation.static final Status
203 Non-Authoritative Information, see HTTP/1.1 documentation.static final Status
406 Not Acceptable, see HTTP/1.1 documentation.static final Status
510 Not Extended, see RFC 2774 - An HTTP Extension Framework.static final Status
404 Not Found, see HTTP/1.1 documentation.static final Status
501 Not Implemented, see HTTP/1.1 documentation.static final Status
304 Not Modified, see HTTP/1.1 documentation.static final Status
200 OK, see HTTP/1.1 documentation.static final Status
206 Reset Content, see HTTP/1.1 documentation.static final Status
402 Payment Required, see HTTP/1.1 documentation.static final Status
308 Permanent Redirect, see HTTP Status Code 308 documentation.static final Status
412 Precondition Failed, see HTTP/1.1 documentation.static final Status
Precondition required, see RFC 6585 - Additional HTTP Status Codes.static final Status
407 Proxy Authentication Required, see HTTP/1.1 documentation.static final Status
413 Request Entity Too Large, see HTTP/1.1 documentation.static final Status
408 Request Timeout, see HTTP/1.1 documentation.static final Status
414 Request-URI Too Long, see HTTP/1.1 documentation.static final Status
416 Requested Range Not Satisfiable, see HTTP/1.1 documentation.static final Status
205 Reset Content, see HTTP/1.1 documentation.static final Status
303 See Other, see HTTP/1.1 documentation.static final Status
503 Service Unavailable, see HTTP/1.1 documentation.static final Status
101 Switching Protocols, see HTTP/1.1 documentations.static final Status
307 Temporary Redirect, see HTTP/1.1 documentation.static final Status
Too many requests, see RFC 6585 - Additional HTTP Status Codes.static final Status
401 Unauthorized, see HTTP/1.1 documentation.static final Status
Unprocessable content, see RFC 9110 - Http Semantics.static final Status
415 Unsupported Media Type, see HTTP/1.1 documentation.static final Status
Upgrade required, see RFC 9110 - Http Semantics.static final Status
305 Use Proxy, see HTTP/1.1 documentation. -
Method Summary
Modifier and TypeMethodDescriptionint
code()
Get the associated integer value representing the status code.codeText()
Text of thecode()
.static Status
create
(int statusCode) Convert a numerical status code into the corresponding Status.static Status
Convert a numerical status code into the corresponding Status.boolean
family()
Get the class of status code.int
hashCode()
Get the reason phrase.text()
Text of the status as used in HTTP/1, such as "200 OK".toString()
Get the response status as string.
-
Field Details
-
CONTINUE_100
100 Continue, see HTTP/1.1 documentations. -
SWITCHING_PROTOCOLS_101
101 Switching Protocols, see HTTP/1.1 documentations. -
OK_200
200 OK, see HTTP/1.1 documentation. -
CREATED_201
201 Created, see HTTP/1.1 documentation. -
ACCEPTED_202
202 Accepted, see HTTP/1.1 documentation . -
NON_AUTHORITATIVE_INFORMATION_203
203 Non-Authoritative Information, see HTTP/1.1 documentation.- Since:
- 4.0.6
-
NO_CONTENT_204
204 No Content, see HTTP/1.1 documentation. -
RESET_CONTENT_205
205 Reset Content, see HTTP/1.1 documentation.- Since:
- 2.0
-
PARTIAL_CONTENT_206
206 Reset Content, see HTTP/1.1 documentation.- Since:
- 2.0
-
MULTI_STATUS_207
207 Multi-Status, see RFC 4918 - HTTP Extensions for WebDAV.- Since:
- 4.0.6
-
MOVED_PERMANENTLY_301
301 Moved Permanently, see HTTP/1.1 documentation. -
FOUND_302
302 Found, see HTTP/1.1 documentation.- Since:
- 2.0
-
SEE_OTHER_303
303 See Other, see HTTP/1.1 documentation. -
NOT_MODIFIED_304
304 Not Modified, see HTTP/1.1 documentation. -
USE_PROXY_305
305 Use Proxy, see HTTP/1.1 documentation.- Since:
- 2.0
-
TEMPORARY_REDIRECT_307
307 Temporary Redirect, see HTTP/1.1 documentation. -
PERMANENT_REDIRECT_308
308 Permanent Redirect, see HTTP Status Code 308 documentation. -
BAD_REQUEST_400
400 Bad Request, see HTTP/1.1 documentation. -
UNAUTHORIZED_401
401 Unauthorized, see HTTP/1.1 documentation. -
PAYMENT_REQUIRED_402
402 Payment Required, see HTTP/1.1 documentation.- Since:
- 2.0
-
FORBIDDEN_403
403 Forbidden, see HTTP/1.1 documentation. -
NOT_FOUND_404
404 Not Found, see HTTP/1.1 documentation. -
METHOD_NOT_ALLOWED_405
405 Method Not Allowed, see HTTP/1.1 documentation.- Since:
- 2.0
-
NOT_ACCEPTABLE_406
406 Not Acceptable, see HTTP/1.1 documentation. -
PROXY_AUTHENTICATION_REQUIRED_407
407 Proxy Authentication Required, see HTTP/1.1 documentation.- Since:
- 2.0
-
REQUEST_TIMEOUT_408
408 Request Timeout, see HTTP/1.1 documentation.- Since:
- 2.0
-
CONFLICT_409
409 Conflict, see HTTP/1.1 documentation. -
GONE_410
410 Gone, see HTTP/1.1 documentation. -
LENGTH_REQUIRED_411
411 Length Required, see HTTP/1.1 documentation.- Since:
- 2.0
-
PRECONDITION_FAILED_412
412 Precondition Failed, see HTTP/1.1 documentation. -
REQUEST_ENTITY_TOO_LARGE_413
413 Request Entity Too Large, see HTTP/1.1 documentation.- Since:
- 2.0
-
REQUEST_URI_TOO_LONG_414
414 Request-URI Too Long, see HTTP/1.1 documentation.- Since:
- 2.0
-
UNSUPPORTED_MEDIA_TYPE_415
415 Unsupported Media Type, see HTTP/1.1 documentation. -
REQUESTED_RANGE_NOT_SATISFIABLE_416
416 Requested Range Not Satisfiable, see HTTP/1.1 documentation.- Since:
- 2.0
-
EXPECTATION_FAILED_417
417 Expectation Failed, see HTTP/1.1 documentation.- Since:
- 2.0
-
I_AM_A_TEAPOT_418
418 I'm a teapot, see Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0). -
MISDIRECTED_REQUEST_421
Misdirected request, see RFC 9110 - Http Semantics. -
UNPROCESSABLE_CONTENT_422
Unprocessable content, see RFC 9110 - Http Semantics. -
LOCKED_423
Locked, see RFC 4918 - HTTP Extensions for WebDAV. -
FAILED_DEPENDENCY_424
Failed dependency, see RFC 4918 - HTTP Extensions for WebDAV. -
UPGRADE_REQUIRED_426
Upgrade required, see RFC 9110 - Http Semantics. -
PRECONDITION_REQUIRED_428
Precondition required, see RFC 6585 - Additional HTTP Status Codes. -
TOO_MANY_REQUESTS_429
Too many requests, see RFC 6585 - Additional HTTP Status Codes. -
INTERNAL_SERVER_ERROR_500
500 Internal Server Error, see HTTP/1.1 documentation. -
NOT_IMPLEMENTED_501
501 Not Implemented, see HTTP/1.1 documentation.- Since:
- 2.0
-
BAD_GATEWAY_502
502 Bad Gateway, see HTTP/1.1 documentation.- Since:
- 2.0
-
SERVICE_UNAVAILABLE_503
503 Service Unavailable, see HTTP/1.1 documentation. -
GATEWAY_TIMEOUT_504
504 Gateway Timeout, see HTTP/1.1 documentation.- Since:
- 2.0
-
HTTP_VERSION_NOT_SUPPORTED_505
505 HTTP Version Not Supported, see HTTP/1.1 documentation.- Since:
- 3.0.3
-
INSUFFICIENT_STORAGE_507
507 Insufficient Storage, see WebDAV documentation.- Since:
- 4.0.6
-
LOOP_DETECTED_508
508 Loop Detected, see RFC 5842 - Bindings for the Constrained Application Protocol (CoAP).- Since:
- 4.0.6
-
NOT_EXTENDED_510
510 Not Extended, see RFC 2774 - An HTTP Extension Framework.- Since:
- 4.0.6
-
NETWORK_AUTHENTICATION_REQUIRED_511
511 Network Authentication Required, see RFC 6585 - Additional HTTP Status Codes.- Since:
- 4.0.6
-
-
Method Details
-
create
Convert a numerical status code into the corresponding Status.For an unknown code, an ad-hoc
Status
is created.- Parameters:
statusCode
- the numerical status code- Returns:
- the matching Status; either a constant from this class, or an ad-hoc
Status
-
create
Convert a numerical status code into the corresponding Status.It either returns an existing
Status
constant if possible. For an unknown code, or code/reason phrase combination it creates an ad-hocStatus
.- Parameters:
statusCode
- the numerical status codereasonPhrase
- the reason phrase; ifnull
or a known reason phrase, an instance with the default phrase is returned; otherwise, a new instance is returned- Returns:
- the matching Status
-
code
public int code()Get the associated integer value representing the status code.- Returns:
- the integer value representing the status code.
-
family
Get the class of status code.- Returns:
- the class of status code.
-
reasonPhrase
Get the reason phrase.- Returns:
- the reason phrase.
-
codeText
Text of thecode()
.- Returns:
- code string (number as a string)
-
toString
Get the response status as string. -
text
Text of the status as used in HTTP/1, such as "200 OK".- Returns:
- text of this status
-
equals
-
hashCode
public int hashCode()
-