Class HttpStatus


  • public class HttpStatus
    extends Object
    This enum encapsulates the HTTP response status and reason phrases as defined by RFC 2616.
    Since:
    2.0
    • Field Detail

      • CONINTUE_100

        public static final HttpStatus CONINTUE_100
      • SWITCHING_PROTOCOLS_101

        public static final HttpStatus SWITCHING_PROTOCOLS_101
      • WEB_SOCKET_PROTOCOL_HANDSHAKE_101

        public static final HttpStatus WEB_SOCKET_PROTOCOL_HANDSHAKE_101
      • CREATED_201

        public static final HttpStatus CREATED_201
      • ACCEPTED_202

        public static final HttpStatus ACCEPTED_202
      • NON_AUTHORATIVE_INFORMATION_203

        public static final HttpStatus NON_AUTHORATIVE_INFORMATION_203
      • NO_CONTENT_204

        public static final HttpStatus NO_CONTENT_204
      • RESET_CONTENT_205

        public static final HttpStatus RESET_CONTENT_205
      • PARTIAL_CONTENT_206

        public static final HttpStatus PARTIAL_CONTENT_206
      • MULTIPLE_CHOICES_300

        public static final HttpStatus MULTIPLE_CHOICES_300
      • MOVED_PERMANENTLY_301

        public static final HttpStatus MOVED_PERMANENTLY_301
      • FOUND_302

        public static final HttpStatus FOUND_302
      • SEE_OTHER_303

        public static final HttpStatus SEE_OTHER_303
      • NOT_MODIFIED_304

        public static final HttpStatus NOT_MODIFIED_304
      • USE_PROXY_305

        public static final HttpStatus USE_PROXY_305
      • TEMPORARY_REDIRECT_307

        public static final HttpStatus TEMPORARY_REDIRECT_307
      • PERMANENT_REDIRECT_308

        public static final HttpStatus PERMANENT_REDIRECT_308
      • BAD_REQUEST_400

        public static final HttpStatus BAD_REQUEST_400
      • UNAUTHORIZED_401

        public static final HttpStatus UNAUTHORIZED_401
      • PAYMENT_REQUIRED_402

        public static final HttpStatus PAYMENT_REQUIRED_402
      • FORBIDDEN_403

        public static final HttpStatus FORBIDDEN_403
      • NOT_FOUND_404

        public static final HttpStatus NOT_FOUND_404
      • METHOD_NOT_ALLOWED_405

        public static final HttpStatus METHOD_NOT_ALLOWED_405
      • NOT_ACCEPTABLE_406

        public static final HttpStatus NOT_ACCEPTABLE_406
      • PROXY_AUTHENTICATION_REQUIRED_407

        public static final HttpStatus PROXY_AUTHENTICATION_REQUIRED_407
      • REQUEST_TIMEOUT_408

        public static final HttpStatus REQUEST_TIMEOUT_408
      • CONFLICT_409

        public static final HttpStatus CONFLICT_409
      • GONE_410

        public static final HttpStatus GONE_410
      • LENGTH_REQUIRED_411

        public static final HttpStatus LENGTH_REQUIRED_411
      • PRECONDITION_FAILED_412

        public static final HttpStatus PRECONDITION_FAILED_412
      • REQUEST_ENTITY_TOO_LARGE_413

        public static final HttpStatus REQUEST_ENTITY_TOO_LARGE_413
      • REQUEST_URI_TOO_LONG_414

        public static final HttpStatus REQUEST_URI_TOO_LONG_414
      • UNSUPPORTED_MEDIA_TYPE_415

        public static final HttpStatus UNSUPPORTED_MEDIA_TYPE_415
      • REQUEST_RANGE_NOT_SATISFIABLE_416

        public static final HttpStatus REQUEST_RANGE_NOT_SATISFIABLE_416
      • EXPECTATION_FAILED_417

        public static final HttpStatus EXPECTATION_FAILED_417
      • MISDIRECTED_REQUEST

        public static final HttpStatus MISDIRECTED_REQUEST
      • REQUEST_HEADER_FIELDS_TOO_LARGE

        public static final HttpStatus REQUEST_HEADER_FIELDS_TOO_LARGE
      • INTERNAL_SERVER_ERROR_500

        public static final HttpStatus INTERNAL_SERVER_ERROR_500
      • NOT_IMPLEMENTED_501

        public static final HttpStatus NOT_IMPLEMENTED_501
      • BAD_GATEWAY_502

        public static final HttpStatus BAD_GATEWAY_502
      • SERVICE_UNAVAILABLE_503

        public static final HttpStatus SERVICE_UNAVAILABLE_503
      • GATEWAY_TIMEOUT_504

        public static final HttpStatus GATEWAY_TIMEOUT_504
      • HTTP_VERSION_NOT_SUPPORTED_505

        public static final HttpStatus HTTP_VERSION_NOT_SUPPORTED_505
    • Method Detail

      • newHttpStatus

        public static HttpStatus newHttpStatus​(int statusCode,
                                               String reasonPhrase)
      • getHttpStatus

        public static HttpStatus getHttpStatus​(int statusCode)
        Parameters:
        statusCode - HTTP status code
        Returns:
        HttpStatus representation of the status.
      • statusMatches

        public boolean statusMatches​(int status)
        Returns:
        true if the specified int status code matches the status of this HttpStatus.
      • getStatusCode

        public int getStatusCode()
        Returns:
        the int status code.
      • getStatusBytes

        public byte[] getStatusBytes()
      • getReasonPhrase

        public String getReasonPhrase()
        Returns:
        the String representation of the reason phrase.
      • getReasonPhraseBytes

        public byte[] getReasonPhraseBytes()
        Returns:
        the bytes containing the reason phrase as defined by RFC 2616.
      • setValues

        public void setValues​(HttpResponsePacket response)
        Sets the status and reason phrase on the specified response.
        Parameters:
        response - the response to set the status and reason phrase on.