Enum Status

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Status>

    public enum Status
    extends java.lang.Enum<Status>
    The Status enumeration is used to specify status codes and the descriptions of those status codes. This is a convenience enumeration that allows users to acquire the descriptions of codes by simply providing the code. Also if the response state is known the code and description can be provided to the client.

    The official HTTP status codes are defined in RFC 2616 section 10. Each set of status codes belongs to a specific family. Each family describes a specific scenario. Although it is possible to use other status codes it is recommended that servers restrict their status code responses to those specified in this enumeration.

    Author:
    Niall Gallagher
    See Also:
    StatusLine
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ACCEPTED
      This is used to signify that the request has been accepted.
      BAD_GATEWAY
      This is used to tell the client that the gateway is invalid.
      BAD_REQUEST
      This is used to tell the client they have send an invalid request.
      CONFLICT
      This is used to tell the client that there has been a conflict.
      CREATED
      This is used to signify that a resource was created successfully.
      EXPECTATION_FAILED
      This is used to tell the client that the expectation has failed.
      FORBIDDEN
      This is used to tell the client that the resource is forbidden.
      FOUND
      This is used to represent a resource that has been found.
      GATEWAY_TIMEOUT
      This is used to tell the client there was a gateway timeout.
      GONE
      This is used to tell the client that the resource has gone.
      INTERNAL_SERVER_ERROR
      This is sent when the request has caused an internal server error.
      LENGTH_REQUIRED
      This is used to tell the client that a request length is needed.
      METHOD_NOT_ALLOWED
      This is used to tell the client that the method is not allowed.
      MOVED_PERMANENTLY
      This is used to represent a target resource that has moved.
      MULTIPLE_CHOICES
      This is used to represent a response where there are choices.
      NO_CONTENT
      This represents a response that contains no response content.
      NOT_ACCEPTABLE
      This is used to tell the client the request is not acceptable.
      NOT_FOUND
      This is used to tell the client that the resource is not found.
      NOT_IMPLEMENTED
      This is used to tell the client the resource is not implemented.
      NOT_MODIFIED
      This is used in response to a target that has not been modified.
      OK
      This represents a successful response of a targeted request.
      PARTIAL_CONTENT
      This is used to represent a response that has partial content.
      PAYMENT_REQUIRED
      This is used to tell the client that payment is required.
      PRECONDITION_FAILED
      This is used to tell the client that a precondition has failed.
      PROXY_AUTHENTICATION_REQUIRED
      This is used to tell the client that authentication is required.
      REQUEST_ENTITY_TOO_LARGE
      This is used to tell the client that the request body is too big.
      REQUEST_TIMEOUT
      This is used to tell the client that the request has timed out.
      REQUEST_URI_TOO_LONG
      This is used to tell the client that the request URI is too long.
      REQUESTED_RANGE_NOT_SATISFIABLE
      This is used to tell the client that the range is invalid.
      RESET_CONTENT
      This is used to represent a response that resets the content.
      SEE_OTHER
      This is used to tell the client to see another HTTP resource.
      SERVICE_UNAVAILABLE
      This is used to tell the client the resource is unavailable.
      TEMPORARY_REDIRECT
      This is used to redirect the client to a resource that has moved.
      UNAUTHORIZED
      This is used to tell the client that authorization is required.
      UNSUPPORTED_MEDIA_TYPE
      This is used to tell the client that the content type is invalid.
      USE_PROXY
      This is used to tell the client that it should use a proxy.
      VERSION_NOT_SUPPORTED
      This is used to tell the client the request version is invalid.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCode()
      This is used to acquire the code of the status object.
      java.lang.String getDescription()
      This is used to provide the status description.
      static java.lang.String getDescription​(int code)
      This is used to provide the status description.
      static Status valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Status[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • OK

        public static final Status OK
        This represents a successful response of a targeted request.
      • CREATED

        public static final Status CREATED
        This is used to signify that a resource was created successfully.
      • ACCEPTED

        public static final Status ACCEPTED
        This is used to signify that the request has been accepted.
      • NO_CONTENT

        public static final Status NO_CONTENT
        This represents a response that contains no response content.
      • RESET_CONTENT

        public static final Status RESET_CONTENT
        This is used to represent a response that resets the content.
      • PARTIAL_CONTENT

        public static final Status PARTIAL_CONTENT
        This is used to represent a response that has partial content.
      • MULTIPLE_CHOICES

        public static final Status MULTIPLE_CHOICES
        This is used to represent a response where there are choices.
      • MOVED_PERMANENTLY

        public static final Status MOVED_PERMANENTLY
        This is used to represent a target resource that has moved.
      • FOUND

        public static final Status FOUND
        This is used to represent a resource that has been found.
      • SEE_OTHER

        public static final Status SEE_OTHER
        This is used to tell the client to see another HTTP resource.
      • NOT_MODIFIED

        public static final Status NOT_MODIFIED
        This is used in response to a target that has not been modified.
      • USE_PROXY

        public static final Status USE_PROXY
        This is used to tell the client that it should use a proxy.
      • TEMPORARY_REDIRECT

        public static final Status TEMPORARY_REDIRECT
        This is used to redirect the client to a resource that has moved.
      • BAD_REQUEST

        public static final Status BAD_REQUEST
        This is used to tell the client they have send an invalid request.
      • UNAUTHORIZED

        public static final Status UNAUTHORIZED
        This is used to tell the client that authorization is required.
      • PAYMENT_REQUIRED

        public static final Status PAYMENT_REQUIRED
        This is used to tell the client that payment is required.
      • FORBIDDEN

        public static final Status FORBIDDEN
        This is used to tell the client that the resource is forbidden.
      • NOT_FOUND

        public static final Status NOT_FOUND
        This is used to tell the client that the resource is not found.
      • METHOD_NOT_ALLOWED

        public static final Status METHOD_NOT_ALLOWED
        This is used to tell the client that the method is not allowed.
      • NOT_ACCEPTABLE

        public static final Status NOT_ACCEPTABLE
        This is used to tell the client the request is not acceptable.
      • PROXY_AUTHENTICATION_REQUIRED

        public static final Status PROXY_AUTHENTICATION_REQUIRED
        This is used to tell the client that authentication is required.
      • REQUEST_TIMEOUT

        public static final Status REQUEST_TIMEOUT
        This is used to tell the client that the request has timed out.
      • CONFLICT

        public static final Status CONFLICT
        This is used to tell the client that there has been a conflict.
      • GONE

        public static final Status GONE
        This is used to tell the client that the resource has gone.
      • LENGTH_REQUIRED

        public static final Status LENGTH_REQUIRED
        This is used to tell the client that a request length is needed.
      • PRECONDITION_FAILED

        public static final Status PRECONDITION_FAILED
        This is used to tell the client that a precondition has failed.
      • REQUEST_ENTITY_TOO_LARGE

        public static final Status REQUEST_ENTITY_TOO_LARGE
        This is used to tell the client that the request body is too big.
      • REQUEST_URI_TOO_LONG

        public static final Status REQUEST_URI_TOO_LONG
        This is used to tell the client that the request URI is too long.
      • UNSUPPORTED_MEDIA_TYPE

        public static final Status UNSUPPORTED_MEDIA_TYPE
        This is used to tell the client that the content type is invalid.
      • REQUESTED_RANGE_NOT_SATISFIABLE

        public static final Status REQUESTED_RANGE_NOT_SATISFIABLE
        This is used to tell the client that the range is invalid.
      • EXPECTATION_FAILED

        public static final Status EXPECTATION_FAILED
        This is used to tell the client that the expectation has failed.
      • INTERNAL_SERVER_ERROR

        public static final Status INTERNAL_SERVER_ERROR
        This is sent when the request has caused an internal server error.
      • NOT_IMPLEMENTED

        public static final Status NOT_IMPLEMENTED
        This is used to tell the client the resource is not implemented.
      • BAD_GATEWAY

        public static final Status BAD_GATEWAY
        This is used to tell the client that the gateway is invalid.
      • SERVICE_UNAVAILABLE

        public static final Status SERVICE_UNAVAILABLE
        This is used to tell the client the resource is unavailable.
      • GATEWAY_TIMEOUT

        public static final Status GATEWAY_TIMEOUT
        This is used to tell the client there was a gateway timeout.
      • VERSION_NOT_SUPPORTED

        public static final Status VERSION_NOT_SUPPORTED
        This is used to tell the client the request version is invalid.
    • Method Detail

      • values

        public static Status[] 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 (Status c : Status.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Status 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
      • getCode

        public int getCode()
        This is used to acquire the code of the status object. This is used in the HTTP response message to tell the client what kind of response this represents. Typically this is used to get a code for a known response state for convenience.
        Returns:
        the code associated by this status instance
      • getDescription

        public java.lang.String getDescription()
        This is used to provide the status description. The description is the textual description of the response state. It is used so that the response can be interpreted and is a required part of the HTTP response combined with the status code.
        Returns:
        the description associated by this status instance
      • getDescription

        public static java.lang.String getDescription​(int code)
        This is used to provide the status description. The description is the textual description of the response state. It is used so that the response can be interpreted and is a required part of the HTTP response combined with the status code.
        Parameters:
        code - this is the code to resolve the description for
        Returns:
        the description associated by this status instance