Enum Class Status

java.lang.Object
java.lang.Enum<Status>
org.simpleframework.http.Status
All Implemented Interfaces:
Serializable, Comparable<Status>, Constable

public enum Status extends 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:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    This is used to signify that the request has been accepted.
    This is used to tell the client that the gateway is invalid.
    This is used to tell the client they have send an invalid request.
    This is used to tell the client that there has been a conflict.
    This is used to signify that a resource was created successfully.
    This is used to tell the client that the expectation has failed.
    This is used to tell the client that the resource is forbidden.
    This is used to represent a resource that has been found.
    This is used to tell the client there was a gateway timeout.
    This is used to tell the client that the resource has gone.
    This is sent when the request has caused an internal server error.
    This is used to tell the client that a request length is needed.
    This is used to tell the client that the method is not allowed.
    This is used to represent a target resource that has moved.
    This is used to represent a response where there are choices.
    This represents a response that contains no response content.
    This is used to tell the client the request is not acceptable.
    This is used to tell the client that the resource is not found.
    This is used to tell the client the resource is not implemented.
    This is used in response to a target that has not been modified.
    This represents a successful response of a targeted request.
    This is used to represent a response that has partial content.
    This is used to tell the client that payment is required.
    This is used to tell the client that a precondition has failed.
    This is used to tell the client that authentication is required.
    This is used to tell the client that the request body is too big.
    This is used to tell the client that the request has timed out.
    This is used to tell the client that the request URI is too long.
    This is used to tell the client that the range is invalid.
    This is used to represent a response that resets the content.
    This is used to tell the client to see another HTTP resource.
    This is used to tell the client the resource is unavailable.
    This is used to redirect the client to a resource that has moved.
    This is used to tell the client that authorization is required.
    This is used to tell the client that the content type is invalid.
    This is used to tell the client that it should use a proxy.
    This is used to tell the client the request version is invalid.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This is used to acquire the code of the status object.
    This is used to provide the status description.
    static String
    getDescription(int code)
    This is used to provide the status description.
    static Status
    Returns the enum constant of this class with the specified name.
    static Status[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

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

    • 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 Details

    • values

      public static Status[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Status valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      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 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 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