Class HttpStatus

java.lang.Object
com.linecorp.armeria.common.HttpStatus
All Implemented Interfaces:
Comparable<HttpStatus>

public final class HttpStatus extends Object implements Comparable<HttpStatus>
HTTP response code and its description.
  • Field Details

    • 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, RFC2518).
    • 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 (since HTTP/1.1).
    • 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, RFC2518).
    • 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.
    • SEE_OTHER

      public static final HttpStatus SEE_OTHER
      303 See Other (since HTTP/1.1).
    • NOT_MODIFIED

      public static final HttpStatus NOT_MODIFIED
      304 Not Modified.
    • USE_PROXY

      public static final HttpStatus USE_PROXY
      305 Use Proxy (since HTTP/1.1).
    • TEMPORARY_REDIRECT

      public static final HttpStatus TEMPORARY_REDIRECT
      307 Temporary Redirect (since HTTP/1.1).
    • 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.
    • REQUEST_ENTITY_TOO_LARGE

      public static final HttpStatus REQUEST_ENTITY_TOO_LARGE
      413 Request Entity Too Large.
    • REQUEST_URI_TOO_LONG

      public static final HttpStatus REQUEST_URI_TOO_LONG
      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.
    • MISDIRECTED_REQUEST

      public static final HttpStatus MISDIRECTED_REQUEST
      421 Misdirected Request.
      See Also:
    • UNPROCESSABLE_ENTITY

      public static final HttpStatus UNPROCESSABLE_ENTITY
      422 Unprocessable Entity (WebDAV, RFC4918).
    • LOCKED

      public static final HttpStatus LOCKED
      423 Locked (WebDAV, RFC4918).
    • FAILED_DEPENDENCY

      public static final HttpStatus FAILED_DEPENDENCY
      424 Failed Dependency (WebDAV, RFC4918).
    • UNORDERED_COLLECTION

      public static final HttpStatus UNORDERED_COLLECTION
      425 Unordered Collection (WebDAV, RFC3648).
    • UPGRADE_REQUIRED

      public static final HttpStatus UPGRADE_REQUIRED
      426 Upgrade Required (RFC2817).
    • PRECONDITION_REQUIRED

      public static final HttpStatus PRECONDITION_REQUIRED
      428 Precondition Required (RFC6585).
    • TOO_MANY_REQUESTS

      public static final HttpStatus TOO_MANY_REQUESTS
      429 Too Many Requests (RFC6585).
    • REQUEST_HEADER_FIELDS_TOO_LARGE

      public static final HttpStatus REQUEST_HEADER_FIELDS_TOO_LARGE
      431 Request Header Fields Too Large (RFC6585).
    • CLIENT_CLOSED_REQUEST

      public static final HttpStatus CLIENT_CLOSED_REQUEST
      499 Client Closed Request.
      See Also:
    • 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 (RFC2295).
    • INSUFFICIENT_STORAGE

      public static final HttpStatus INSUFFICIENT_STORAGE
      507 Insufficient Storage (WebDAV, RFC4918).
    • NOT_EXTENDED

      public static final HttpStatus NOT_EXTENDED
      510 Not Extended (RFC2774).
    • NETWORK_AUTHENTICATION_REQUIRED

      public static final HttpStatus NETWORK_AUTHENTICATION_REQUIRED
      511 Network Authentication Required (RFC6585).
    • UNKNOWN

      public static final HttpStatus UNKNOWN
      A special status code '0' which represents that the response status is unknown.
  • Constructor Details

    • HttpStatus

      public HttpStatus(int statusCode, @Nullable @Nullable String reasonPhrase)
      Creates a new instance with the specified status code and its reason phrase.
  • Method Details

    • valueOf

      public static HttpStatus valueOf(int statusCode)
      Returns the HttpStatus represented by the specified status code.
    • valueOf

      public static HttpStatus valueOf(String statusText)
      Returns the HttpStatus represented by the specified status text.
      Returns:
      the parsed HttpStatus, or UNKNOWN if failed to parse.
      See Also:
    • isContentAlwaysEmpty

      public static boolean isContentAlwaysEmpty(int statusCode)
      Returns true if the content of the response for the specified status code is expected to be always empty (204, 205 and 304 responses.)
    • code

      public int code()
      Returns the code of this HttpStatus.
    • codeAsText

      public String codeAsText()
      Returns the status code as String.
    • reasonPhrase

      public String reasonPhrase()
      Returns the reason phrase of this HttpStatus.
    • codeClass

      public HttpStatusClass codeClass()
      Returns the class of this HttpStatus.
    • toHttpData

      public HttpData toHttpData()
      Returns the HttpData whose content is "<code> <reasonPhrase>" encoded in UTF-8. Do not modify the content of the returned HttpData; it will be reused.
    • isContentAlwaysEmpty

      public boolean isContentAlwaysEmpty()
      Returns true if the content of the response for this HttpStatus is expected to be always empty (204, 205 and 304 responses.)
      See Also:
    • isInformational

      public boolean isInformational()
      Returns whether the HttpStatus is an information, with a status code of 1XX.
    • isSuccess

      public boolean isSuccess()
      Returns whether the HttpStatus is a success, with a status code of 2XX.
    • isRedirection

      public boolean isRedirection()
      Returns whether the HttpStatus is a redirection, with a status code of 3XX.
    • isClientError

      public boolean isClientError()
      Returns whether the HttpStatus is a client error, with a status code of 4XX.
    • isServerError

      public boolean isServerError()
      Returns whether the HttpStatus is a server error, with a status code of 5XX.
    • isError

      public boolean isError()
      Returns whether the HttpStatus is an error.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object o)
      Returns whether the specified object is "equal to" this status.

      Equality of HttpStatus only depends on code(). The reason phrase is not considered for equality.

      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(HttpStatus o)
      Compares this status to the specified status.

      Equality of HttpStatus only depends on code(). The reason phrase is not considered for equality.

      Specified by:
      compareTo in interface Comparable<HttpStatus>
    • toString

      public String toString()
      Overrides:
      toString in class Object