Enum HttpStatusCode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<HttpStatusCode>, org.refcodes.mixin.StatusCodeAccessor<java.lang.Integer>

    public enum HttpStatusCode
    extends java.lang.Enum<HttpStatusCode>
    implements org.refcodes.mixin.StatusCodeAccessor<java.lang.Integer>
    The org.apache.commons.httpclient.HttpStatus constants as enumeration.
    • Enum Constant Detail

      • CONTINUE

        public static final HttpStatusCode CONTINUE
        100 Continue (HTTP/1.1 - RFC 2616)
      • SWITCHING_PROTOCOLS

        public static final HttpStatusCode SWITCHING_PROTOCOLS
        101 Switching Protocols (HTTP/1.1 - RFC 2616)
      • PROCESSING

        public static final HttpStatusCode PROCESSING
        102 Processing (WebDAV - RFC 2518).
      • OK

        public static final HttpStatusCode OK
        200 OK (HTTP/1.0 - RFC 1945)
      • CREATED

        public static final HttpStatusCode CREATED
        201 Created (HTTP/1.0 - RFC 1945)
      • ACCEPTED

        public static final HttpStatusCode ACCEPTED
        202 Accepted (HTTP/1.0 - RFC 1945)
      • NON_AUTHORITATIVE_INFORMATION

        public static final HttpStatusCode NON_AUTHORITATIVE_INFORMATION
        203 Non Authoritative Information (HTTP/1.1 - RFC 2616)
      • NO_CONTENT

        public static final HttpStatusCode NO_CONTENT
        204 No Content (HTTP/1.0 - RFC 1945)
      • RESET_CONTENT

        public static final HttpStatusCode RESET_CONTENT
        205 Reset Content (HTTP/1.1 - RFC 2616)
      • PARTIAL_CONTENT

        public static final HttpStatusCode PARTIAL_CONTENT
        206 Partial Content (HTTP/1.1 - RFC 2616)
      • MULTI_STATUS

        public static final HttpStatusCode MULTI_STATUS
        207 Multi-Status (WebDAV - RFC 2518) or 207 Partial Update OK (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?)
      • MULTIPLE_CHOICES

        public static final HttpStatusCode MULTIPLE_CHOICES
        300 Mutliple Choices (HTTP/1.1 - RFC 2616)
      • MOVED_PERMANENTLY

        public static final HttpStatusCode MOVED_PERMANENTLY
        301 Moved Permanently (HTTP/1.0 - RFC 1945)
      • MOVED_TEMPORARILY

        public static final HttpStatusCode MOVED_TEMPORARILY
        302 Moved Temporarily (Sometimes Found) (HTTP/1.0 - RFC 1945)
      • SEE_OTHER

        public static final HttpStatusCode SEE_OTHER
        303 See Other (HTTP/1.1 - RFC 2616)
      • NOT_MODIFIED

        public static final HttpStatusCode NOT_MODIFIED
        304 Not Modified (HTTP/1.0 - RFC 1945)
      • USE_PROXY

        public static final HttpStatusCode USE_PROXY
        305 Use Proxy (HTTP/1.1 - RFC 2616)
      • TEMPORARY_REDIRECT

        public static final HttpStatusCode TEMPORARY_REDIRECT
        307 Temporary Redirect (HTTP/1.1 - RFC 2616)
      • BAD_REQUEST

        public static final HttpStatusCode BAD_REQUEST
        400 Bad Request (HTTP/1.1 - RFC 2616)
      • UNAUTHORIZED

        public static final HttpStatusCode UNAUTHORIZED
        401 Unauthorized (HTTP/1.0 - RFC 1945)
      • PAYMENT_REQUIRED

        public static final HttpStatusCode PAYMENT_REQUIRED
        402 Payment Required (HTTP/1.1 - RFC 2616)
      • FORBIDDEN

        public static final HttpStatusCode FORBIDDEN
        403 Forbidden (HTTP/1.0 - RFC 1945)
      • NOT_FOUND

        public static final HttpStatusCode NOT_FOUND
        404 Not Found (HTTP/1.0 - RFC 1945)
      • METHOD_NOT_ALLOWED

        public static final HttpStatusCode METHOD_NOT_ALLOWED
        405 Method Not Allowed (HTTP/1.1 - RFC 2616)
      • NOT_ACCEPTABLE

        public static final HttpStatusCode NOT_ACCEPTABLE
        406 Not Acceptable (HTTP/1.1 - RFC 2616)
      • PROXY_AUTHENTICATION_REQUIRED

        public static final HttpStatusCode PROXY_AUTHENTICATION_REQUIRED
        407 Proxy Authentication Required (HTTP/1.1 - RFC 2616)
      • REQUEST_TIMEOUT

        public static final HttpStatusCode REQUEST_TIMEOUT
        408 Request Timeout (HTTP/1.1 - RFC 2616)
      • CONFLICT

        public static final HttpStatusCode CONFLICT
        409 Conflict (HTTP/1.1 - RFC 2616)
      • GONE

        public static final HttpStatusCode GONE
        410 Gone (HTTP/1.1 - RFC 2616)
      • LENGTH_REQUIRED

        public static final HttpStatusCode LENGTH_REQUIRED
        411 Length Required (HTTP/1.1 - RFC 2616)
      • PRECONDITION_FAILED

        public static final HttpStatusCode PRECONDITION_FAILED
        412 Precondition Failed (HTTP/1.1 - RFC 2616)
      • REQUEST_TOO_LONG

        public static final HttpStatusCode REQUEST_TOO_LONG
        413 Request Entity Too Large (HTTP/1.1 - RFC 2616)
      • REQUEST_URI_TOO_LONG

        public static final HttpStatusCode REQUEST_URI_TOO_LONG
        414 Request-URI Too Long (HTTP/1.1 - RFC 2616)
      • UNSUPPORTED_MEDIA_TYPE

        public static final HttpStatusCode UNSUPPORTED_MEDIA_TYPE
        415 Unsupported Media Type (HTTP/1.1 - RFC 2616)
      • REQUESTED_RANGE_NOT_SATISFIABLE

        public static final HttpStatusCode REQUESTED_RANGE_NOT_SATISFIABLE
        416 Requested Range Not Satisfiable (HTTP/1.1 - RFC 2616)
      • EXPECTATION_FAILED

        public static final HttpStatusCode EXPECTATION_FAILED
        417 Expectation Failed (HTTP/1.1 - RFC 2616)
      • REAUTHENTICATION_REQUIRED

        public static final HttpStatusCode REAUTHENTICATION_REQUIRED
        418 Unprocessable Entity (WebDAV drafts?) or 418 Reauthentication Required (HTTP/1.1 drafts?)
      • INSUFFICIENT_SPACE_ON_RESOURCE

        public static final HttpStatusCode INSUFFICIENT_SPACE_ON_RESOURCE
        419 Insufficient Space on Resource (WebDAV - draft-ietf-webdav-protocol-05?) or 419 Proxy Reauthentication Required (HTTP/1.1 drafts?)
      • METHOD_FAILURE

        public static final HttpStatusCode METHOD_FAILURE
        420 Method Failure (WebDAV - draft-ietf-webdav-protocol-05?).
      • UNPROCESSABLE_ENTITY

        public static final HttpStatusCode UNPROCESSABLE_ENTITY
        422 Unprocessable Entity (WebDAV - RFC 2518).
      • LOCKED

        public static final HttpStatusCode LOCKED
        423 Locked (WebDAV - RFC 2518).
      • FAILED_DEPENDENCY

        public static final HttpStatusCode FAILED_DEPENDENCY
        424 Failed Dependency (WebDAV - RFC 2518).
      • UNAVAILABLE_FOR_LEGAL_REASONS

        public static final HttpStatusCode UNAVAILABLE_FOR_LEGAL_REASONS
        451 Unavailable For Legal Reasons (HTTP - RFC 7725).
      • INTERNAL_SERVER_ERROR

        public static final HttpStatusCode INTERNAL_SERVER_ERROR
        500 Server Error (HTTP/1.0 - RFC 1945)
      • NOT_IMPLEMENTED

        public static final HttpStatusCode NOT_IMPLEMENTED
        501 Not Implemented (HTTP/1.0 - RFC 1945)
      • BAD_GATEWAY

        public static final HttpStatusCode BAD_GATEWAY
        502 Bad Gateway (HTTP/1.0 - RFC 1945)
      • SERVICE_UNAVAILABLE

        public static final HttpStatusCode SERVICE_UNAVAILABLE
        503 Service Unavailable (HTTP/1.0 - RFC 1945)
      • GATEWAY_TIMEOUT

        public static final HttpStatusCode GATEWAY_TIMEOUT
        504 Gateway Timeout (HTTP/1.1 - RFC 2616)
      • HTTP_VERSION_NOT_SUPPORTED

        public static final HttpStatusCode HTTP_VERSION_NOT_SUPPORTED
        505 HTTP Version Not Supported (HTTP/1.1 - RFC 2616)
      • INSUFFICIENT_STORAGE

        public static final HttpStatusCode INSUFFICIENT_STORAGE
        507 Insufficient Storage (WebDAV - RFC 2518).
      • INTERNAL_CLIENT_ERROR

        public static final HttpStatusCode INTERNAL_CLIENT_ERROR
        Proprietary code and only used inside a REFCODES.ORG client not trespassing any networking border. This code is used is used when a client signals a client business logic that internal client processing failed even though the response was received fine.
      • BAD_RESPONSE

        public static final HttpStatusCode BAD_RESPONSE
        Proprietary code and only used inside a REFCODES.ORG client not trespassing any networking border. This code is used when a client signals a bad response being received by a server, e.g. the response cannot be processed by the client and does not meet the client's expectations.
    • Method Detail

      • values

        public static HttpStatusCode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (HttpStatusCode c : HttpStatusCode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static HttpStatusCode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getStatusCode

        public java.lang.Integer getStatusCode()
        Specified by:
        getStatusCode in interface org.refcodes.mixin.StatusCodeAccessor<java.lang.Integer>
      • isSuccessStatus

        public boolean isSuccessStatus()
        Determines whether the given HTTP Status-Code signals a success.
        Returns:
        True in case the HttpStatusCode represents an OK status.
      • isErrorStatus

        public boolean isErrorStatus()
        Determines whether the given HTTP Status-Code signals a failure.
        Returns:
        True in case the HttpStatusCode represents an ERROR status.
      • toHttpStatusCode

        public static HttpStatusCode toHttpStatusCode​(int aHttpStatusCode)
        Determines the HTTP success code from the given value by evaluating the getStatusCode() property.
        Parameters:
        aHttpStatusCode - The code from which to get the HttpStatusCode element.
        Returns:
        The according HttpStatusCode element or null if none was found.
      • toHttpStatusCode

        public static HttpStatusCode toHttpStatusCode​(org.refcodes.mixin.StatusCodeAccessor<java.lang.Integer> aHttpStatusCode)
        Determines the HTTP success code from the given HTTP Status-Code property by evaluating the getStatusCode() property.
        Parameters:
        aHttpStatusCode - The code property from which StatusCodeAccessor.getStatusCode() to get the HttpStatusCode element.
        Returns:
        The according HttpStatusCode element or null if none was found.
      • toHttpStatusException

        public HttpStatusException toHttpStatusException​(java.lang.String aMessage)
        If the status is an erroneous status as of isErrorStatus() , then this method creates the according HttpStatusException exception.
        Parameters:
        aMessage - The message to be contained in the exception.
        Returns:
        The according exception or null if we do not have an erronous status..
      • toHttpStatusRuntimeException

        public HttpStatusRuntimeException toHttpStatusRuntimeException​(java.lang.String aMessage)
        If the status is an erroneous status as of isErrorStatus(), then this method creates the according HttpStatusRuntimeException exception.
        Parameters:
        aMessage - The message to be contained in the exception.
        Returns:
        The according exception or null if we do not have an erronous status.
      • toVerbose

        public java.lang.String toVerbose()
        Returns the verbose text for the according HTTP-Status-Code. The verbose text for the HTTP-Status-Code 200 would be "OK".
        Returns:
        The verbose code for the HttpStatusCode.