Enum Response.Status

java.lang.Object
java.lang.Enum<Response.Status>
javax.ws.rs.core.Response.Status
All Implemented Interfaces:
Serializable, Comparable<Response.Status>, Response.StatusType
Enclosing class:
Response

public static enum Response.Status extends Enum<Response.Status> implements Response.StatusType
Commonly used status codes defined by HTTP, see
invalid @link
{@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10">HTTP/1.1
documentation} for the complete list. Additional status codes can be added by applications by creating an implementation of Response.StatusType.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    An enumeration representing the class of status code.
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    202 Accepted, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3">HTTP/1.1
    documentation}.
    400 Bad Request, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">HTTP/1.1
    documentation}.
    409 Conflict, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10">HTTP/1.1
    documentation}.
    201 Created, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2">HTTP/1.1
    documentation}.
    403 Forbidden, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4">HTTP/1.1
    documentation}.
    410 Gone, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11">HTTP/1.1
    documentation}.
    500 Internal Server Error, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">HTTP/1.1
    documentation}.
    301 Moved Permanently, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2">HTTP/1.1
    documentation}.
    204 No Content, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5">HTTP/1.1
    documentation}.
    406 Not Acceptable, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">HTTP/1.1
    documentation}.
    404 Not Found, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">HTTP/1.1
    documentation}.
    304 Not Modified, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5">HTTP/1.1
    documentation}.
    200 OK, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">HTTP/1.1
    documentation}.
    412 Precondition Failed, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.13">HTTP/1.1
    documentation}.
    303 See Other, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4">HTTP/1.1
    documentation}.
    503 Service Unavailable, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4">HTTP/1.1
    documentation}.
    307 Temporary Redirect, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8">HTTP/1.1
    documentation}.
    401 Unauthorized, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">HTTP/1.1
    documentation}.
    415 Unsupported Media Type, see
    invalid @link
    {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16">HTTP/1.1
    documentation}.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
     
     
    private final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Status(int statusCode, String reasonPhrase)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    fromStatusCode(int statusCode)
    Convert a numerical status code into the corresponding Status
    Get the class of status code
    Get the reason phrase
    int
    Get the associated status code
    Get the reason phrase
    Returns the enum constant of this type with the specified name.
    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, valueOf

    Methods inherited from class java.lang.Object

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

    • OK

      public static final Response.Status OK
      200 OK, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">HTTP/1.1
      documentation}.
    • CREATED

      public static final Response.Status CREATED
      201 Created, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2">HTTP/1.1
      documentation}.
    • ACCEPTED

      public static final Response.Status ACCEPTED
      202 Accepted, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3">HTTP/1.1
      documentation}.
    • NO_CONTENT

      public static final Response.Status NO_CONTENT
      204 No Content, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5">HTTP/1.1
      documentation}.
    • MOVED_PERMANENTLY

      public static final Response.Status MOVED_PERMANENTLY
      301 Moved Permanently, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2">HTTP/1.1
      documentation}.
    • SEE_OTHER

      public static final Response.Status SEE_OTHER
      303 See Other, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4">HTTP/1.1
      documentation}.
    • NOT_MODIFIED

      public static final Response.Status NOT_MODIFIED
      304 Not Modified, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5">HTTP/1.1
      documentation}.
    • TEMPORARY_REDIRECT

      public static final Response.Status TEMPORARY_REDIRECT
      307 Temporary Redirect, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8">HTTP/1.1
      documentation}.
    • BAD_REQUEST

      public static final Response.Status BAD_REQUEST
      400 Bad Request, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">HTTP/1.1
      documentation}.
    • UNAUTHORIZED

      public static final Response.Status UNAUTHORIZED
      401 Unauthorized, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">HTTP/1.1
      documentation}.
    • FORBIDDEN

      public static final Response.Status FORBIDDEN
      403 Forbidden, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4">HTTP/1.1
      documentation}.
    • NOT_FOUND

      public static final Response.Status NOT_FOUND
      404 Not Found, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">HTTP/1.1
      documentation}.
    • NOT_ACCEPTABLE

      public static final Response.Status NOT_ACCEPTABLE
      406 Not Acceptable, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">HTTP/1.1
      documentation}.
    • CONFLICT

      public static final Response.Status CONFLICT
      409 Conflict, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10">HTTP/1.1
      documentation}.
    • GONE

      public static final Response.Status GONE
      410 Gone, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11">HTTP/1.1
      documentation}.
    • PRECONDITION_FAILED

      public static final Response.Status PRECONDITION_FAILED
      412 Precondition Failed, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.13">HTTP/1.1
      documentation}.
    • UNSUPPORTED_MEDIA_TYPE

      public static final Response.Status UNSUPPORTED_MEDIA_TYPE
      415 Unsupported Media Type, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16">HTTP/1.1
      documentation}.
    • INTERNAL_SERVER_ERROR

      public static final Response.Status INTERNAL_SERVER_ERROR
      500 Internal Server Error, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">HTTP/1.1
      documentation}.
    • SERVICE_UNAVAILABLE

      public static final Response.Status SERVICE_UNAVAILABLE
      503 Service Unavailable, see
      invalid @link
      {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4">HTTP/1.1
      documentation}.
  • Field Details

  • Constructor Details

    • Status

      private Status(int statusCode, String reasonPhrase)
  • Method Details

    • values

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

      public static Response.Status valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getFamily

      public Response.Status.Family getFamily()
      Get the class of status code
      Specified by:
      getFamily in interface Response.StatusType
      Returns:
      the class of status code
    • getStatusCode

      public int getStatusCode()
      Get the associated status code
      Specified by:
      getStatusCode in interface Response.StatusType
      Returns:
      the status code
    • getReasonPhrase

      public String getReasonPhrase()
      Get the reason phrase
      Specified by:
      getReasonPhrase in interface Response.StatusType
      Returns:
      the reason phrase
    • toString

      public String toString()
      Get the reason phrase
      Overrides:
      toString in class Enum<Response.Status>
      Returns:
      the reason phrase
    • fromStatusCode

      public static Response.Status fromStatusCode(int statusCode)
      Convert a numerical status code into the corresponding Status
      Parameters:
      statusCode - the numerical status code
      Returns:
      the matching Status or null is no matching Status is defined