Class HttpResponseStatus

  • All Implemented Interfaces:
    java.lang.Comparable<HttpResponseStatus>

    public class HttpResponseStatus
    extends java.lang.Object
    implements java.lang.Comparable<HttpResponseStatus>
    The response code and its description of HTTP or its derived protocols, such as RTSP and ICAP.
    • Field Detail

      • SWITCHING_PROTOCOLS

        public static final HttpResponseStatus SWITCHING_PROTOCOLS
        101 Switching Protocols
      • PROCESSING

        public static final HttpResponseStatus PROCESSING
        102 Processing (WebDAV, RFC2518)
      • EARLY_HINTS

        public static final HttpResponseStatus EARLY_HINTS
        103 Early Hints (RFC 8297)
      • NON_AUTHORITATIVE_INFORMATION

        public static final HttpResponseStatus NON_AUTHORITATIVE_INFORMATION
        203 Non-Authoritative Information (since HTTP/1.1)
      • PARTIAL_CONTENT

        public static final HttpResponseStatus PARTIAL_CONTENT
        206 Partial Content
      • MULTI_STATUS

        public static final HttpResponseStatus MULTI_STATUS
        207 Multi-Status (WebDAV, RFC2518)
      • MULTIPLE_CHOICES

        public static final HttpResponseStatus MULTIPLE_CHOICES
        300 Multiple Choices
      • MOVED_PERMANENTLY

        public static final HttpResponseStatus MOVED_PERMANENTLY
        301 Moved Permanently
      • SEE_OTHER

        public static final HttpResponseStatus SEE_OTHER
        303 See Other (since HTTP/1.1)
      • USE_PROXY

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

        public static final HttpResponseStatus TEMPORARY_REDIRECT
        307 Temporary Redirect (since HTTP/1.1)
      • PERMANENT_REDIRECT

        public static final HttpResponseStatus PERMANENT_REDIRECT
        308 Permanent Redirect (RFC7538)
      • PAYMENT_REQUIRED

        public static final HttpResponseStatus PAYMENT_REQUIRED
        402 Payment Required
      • METHOD_NOT_ALLOWED

        public static final HttpResponseStatus METHOD_NOT_ALLOWED
        405 Method Not Allowed
      • NOT_ACCEPTABLE

        public static final HttpResponseStatus NOT_ACCEPTABLE
        406 Not Acceptable
      • PROXY_AUTHENTICATION_REQUIRED

        public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED
        407 Proxy Authentication Required
      • REQUEST_TIMEOUT

        public static final HttpResponseStatus REQUEST_TIMEOUT
        408 Request Timeout
      • LENGTH_REQUIRED

        public static final HttpResponseStatus LENGTH_REQUIRED
        411 Length Required
      • PRECONDITION_FAILED

        public static final HttpResponseStatus PRECONDITION_FAILED
        412 Precondition Failed
      • REQUEST_ENTITY_TOO_LARGE

        public static final HttpResponseStatus REQUEST_ENTITY_TOO_LARGE
        413 Request Entity Too Large
      • REQUEST_URI_TOO_LONG

        public static final HttpResponseStatus REQUEST_URI_TOO_LONG
        414 Request-URI Too Long
      • UNSUPPORTED_MEDIA_TYPE

        public static final HttpResponseStatus UNSUPPORTED_MEDIA_TYPE
        415 Unsupported Media Type
      • REQUESTED_RANGE_NOT_SATISFIABLE

        public static final HttpResponseStatus REQUESTED_RANGE_NOT_SATISFIABLE
        416 Requested Range Not Satisfiable
      • EXPECTATION_FAILED

        public static final HttpResponseStatus EXPECTATION_FAILED
        417 Expectation Failed
      • UNPROCESSABLE_ENTITY

        public static final HttpResponseStatus UNPROCESSABLE_ENTITY
        422 Unprocessable Entity (WebDAV, RFC4918)
      • FAILED_DEPENDENCY

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

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

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

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

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

        public static final HttpResponseStatus REQUEST_HEADER_FIELDS_TOO_LARGE
        431 Request Header Fields Too Large (RFC6585)
      • INTERNAL_SERVER_ERROR

        public static final HttpResponseStatus INTERNAL_SERVER_ERROR
        500 Internal Server Error
      • NOT_IMPLEMENTED

        public static final HttpResponseStatus NOT_IMPLEMENTED
        501 Not Implemented
      • SERVICE_UNAVAILABLE

        public static final HttpResponseStatus SERVICE_UNAVAILABLE
        503 Service Unavailable
      • GATEWAY_TIMEOUT

        public static final HttpResponseStatus GATEWAY_TIMEOUT
        504 Gateway Timeout
      • HTTP_VERSION_NOT_SUPPORTED

        public static final HttpResponseStatus HTTP_VERSION_NOT_SUPPORTED
        505 HTTP Version Not Supported
      • VARIANT_ALSO_NEGOTIATES

        public static final HttpResponseStatus VARIANT_ALSO_NEGOTIATES
        506 Variant Also Negotiates (RFC2295)
      • INSUFFICIENT_STORAGE

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

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

        public static final HttpResponseStatus NETWORK_AUTHENTICATION_REQUIRED
        511 Network Authentication Required (RFC6585)
    • Constructor Detail

      • HttpResponseStatus

        public HttpResponseStatus​(int code,
                                  java.lang.String reasonPhrase)
        Creates a new instance with the specified code and its reasonPhrase.
    • Method Detail

      • valueOf

        public static HttpResponseStatus valueOf​(int code)
        Returns the HttpResponseStatus represented by the specified code. If the specified code is a standard HTTP status code, a cached instance will be returned. Otherwise, a new instance will be returned.
      • valueOf

        public static HttpResponseStatus valueOf​(int code,
                                                 java.lang.String reasonPhrase)
        Returns the HttpResponseStatus represented by the specified code and reasonPhrase. If the specified code is a standard HTTP status code and reasonPhrase, a cached instance will be returned. Otherwise, a new instance will be returned.
        Parameters:
        code - The response code value.
        reasonPhrase - The response code reason phrase.
        Returns:
        the HttpResponseStatus represented by the specified code and reasonPhrase.
      • parseLine

        public static HttpResponseStatus parseLine​(java.lang.CharSequence line)
        Parses the specified HTTP status line into a HttpResponseStatus. The expected formats of the line are:
        • statusCode (e.g. 200)
        • statusCode reasonPhrase (e.g. 404 Not Found)
        Throws:
        java.lang.IllegalArgumentException - if the specified status line is malformed
      • parseLine

        public static HttpResponseStatus parseLine​(java.lang.String line)
        Parses the specified HTTP status line into a HttpResponseStatus. The expected formats of the line are:
        • statusCode (e.g. 200)
        • statusCode reasonPhrase (e.g. 404 Not Found)
        Throws:
        java.lang.IllegalArgumentException - if the specified status line is malformed
      • parseLine

        public static HttpResponseStatus parseLine​(AsciiString line)
        Parses the specified HTTP status line into a HttpResponseStatus. The expected formats of the line are:
        • statusCode (e.g. 200)
        • statusCode reasonPhrase (e.g. 404 Not Found)
        Throws:
        java.lang.IllegalArgumentException - if the specified status line is malformed
      • reasonPhrase

        public java.lang.String reasonPhrase()
        Returns the reason phrase of this HttpResponseStatus.
      • hashCode

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

        public boolean equals​(java.lang.Object o)
        Equality of HttpResponseStatus only depends on code(). The reason phrase is not considered for equality.
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object