Package org.simpleframework.http
Enum Status
- java.lang.Object
-
- java.lang.Enum<Status>
-
- org.simpleframework.http.Status
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Status>
public enum Status extends java.lang.Enum<Status>
TheStatus
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.
- 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.CONTINUE
This is used as an intermediate response to a request.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.SWITCHING_PROTOCOLS
This represents a change in the protocol the client is using.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.
-
Field Summary
Fields Modifier and Type Field Description int
code
This is the code for the status that this instance represents.java.lang.String
description
This is the description of the status this instance represents.
-
Constructor Summary
Constructors Modifier Constructor Description private
Status(int code, java.lang.String description)
Constructor for theStatus
object.
-
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
getStatus(int code)
This is used to provide the status value.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.
-
-
-
Enum Constant Detail
-
CONTINUE
public static final Status CONTINUE
This is used as an intermediate response to a request.
-
SWITCHING_PROTOCOLS
public static final Status SWITCHING_PROTOCOLS
This represents a change in the protocol the client is using.
-
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.
-
-
Constructor Detail
-
Status
private Status(int code, java.lang.String description)
Constructor for theStatus
object. This will create a status object that is used to represent a response state. It contains a status code and a description of that code.- Parameters:
code
- this is the code that is used for this statusdescription
- this is the description used for the status
-
-
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 namejava.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 code
-
getStatus
public static Status getStatus(int code)
This is used to provide the status value. If the specified code can not be matched this will return the default HTTP/1.1 status code of OK, which may not match the intended status.- Parameters:
code
- this is the code to resolve the status for- Returns:
- the status value associated by this status code
-
-