Class HttpStatus

java.lang.Object
com.jsgalactic.axiom.http.HttpStatus

public final class HttpStatus extends Object
Status codes used by Axiom applications and runtimes, with their RFC 9110 reason phrases. Plain int constants keep Response and handler code free of wrapper types.
  • Field Details

    • OK

      public static final int OK
      200 OK.
      See Also:
    • CREATED

      public static final int CREATED
      201 Created; pair with a Location header.
      See Also:
    • ACCEPTED

      public static final int ACCEPTED
      202 Accepted.
      See Also:
    • NO_CONTENT

      public static final int NO_CONTENT
      204 No Content; never carries a body.
      See Also:
    • RESET_CONTENT

      public static final int RESET_CONTENT
      205 Reset Content; never carries a body.
      See Also:
    • PARTIAL_CONTENT

      public static final int PARTIAL_CONTENT
      206 Partial Content; carries one range or a multipart/byteranges body.
      See Also:
    • MOVED_PERMANENTLY

      public static final int MOVED_PERMANENTLY
      301 Moved Permanently.
      See Also:
    • FOUND

      public static final int FOUND
      302 Found.
      See Also:
    • SEE_OTHER

      public static final int SEE_OTHER
      303 See Other.
      See Also:
    • NOT_MODIFIED

      public static final int NOT_MODIFIED
      304 Not Modified; never carries a body.
      See Also:
    • TEMPORARY_REDIRECT

      public static final int TEMPORARY_REDIRECT
      307 Temporary Redirect.
      See Also:
    • PERMANENT_REDIRECT

      public static final int PERMANENT_REDIRECT
      308 Permanent Redirect.
      See Also:
    • BAD_REQUEST

      public static final int BAD_REQUEST
      400 Bad Request.
      See Also:
    • UNAUTHORIZED

      public static final int UNAUTHORIZED
      401 Unauthorized.
      See Also:
    • FORBIDDEN

      public static final int FORBIDDEN
      403 Forbidden.
      See Also:
    • NOT_FOUND

      public static final int NOT_FOUND
      404 Not Found.
      See Also:
    • METHOD_NOT_ALLOWED

      public static final int METHOD_NOT_ALLOWED
      405 Method Not Allowed.
      See Also:
    • NOT_ACCEPTABLE

      public static final int NOT_ACCEPTABLE
      406 Not Acceptable.
      See Also:
    • REQUEST_TIMEOUT

      public static final int REQUEST_TIMEOUT
      408 Request Timeout.
      See Also:
    • CONFLICT

      public static final int CONFLICT
      409 Conflict.
      See Also:
    • GONE

      public static final int GONE
      410 Gone.
      See Also:
    • LENGTH_REQUIRED

      public static final int LENGTH_REQUIRED
      411 Length Required.
      See Also:
    • PRECONDITION_FAILED

      public static final int PRECONDITION_FAILED
      412 Precondition Failed.
      See Also:
    • CONTENT_TOO_LARGE

      public static final int CONTENT_TOO_LARGE
      413 Content Too Large.
      See Also:
    • URI_TOO_LONG

      public static final int URI_TOO_LONG
      414 URI Too Long.
      See Also:
    • UNSUPPORTED_MEDIA_TYPE

      public static final int UNSUPPORTED_MEDIA_TYPE
      415 Unsupported Media Type.
      See Also:
    • RANGE_NOT_SATISFIABLE

      public static final int RANGE_NOT_SATISFIABLE
      416 Range Not Satisfiable; carries Content-Range with an asterisk.
      See Also:
    • EXPECTATION_FAILED

      public static final int EXPECTATION_FAILED
      417 Expectation Failed.
      See Also:
    • UNPROCESSABLE_CONTENT

      public static final int UNPROCESSABLE_CONTENT
      422 Unprocessable Content.
      See Also:
    • PRECONDITION_REQUIRED

      public static final int PRECONDITION_REQUIRED
      428 Precondition Required.
      See Also:
    • TOO_MANY_REQUESTS

      public static final int TOO_MANY_REQUESTS
      429 Too Many Requests.
      See Also:
    • REQUEST_HEADER_FIELDS_TOO_LARGE

      public static final int REQUEST_HEADER_FIELDS_TOO_LARGE
      431 Request Header Fields Too Large.
      See Also:
    • INTERNAL_SERVER_ERROR

      public static final int INTERNAL_SERVER_ERROR
      500 Internal Server Error.
      See Also:
    • NOT_IMPLEMENTED

      public static final int NOT_IMPLEMENTED
      501 Not Implemented.
      See Also:
    • BAD_GATEWAY

      public static final int BAD_GATEWAY
      502 Bad Gateway.
      See Also:
    • SERVICE_UNAVAILABLE

      public static final int SERVICE_UNAVAILABLE
      503 Service Unavailable.
      See Also:
    • GATEWAY_TIMEOUT

      public static final int GATEWAY_TIMEOUT
      504 Gateway Timeout.
      See Also:
    • HTTP_VERSION_NOT_SUPPORTED

      public static final int HTTP_VERSION_NOT_SUPPORTED
      505 HTTP Version Not Supported.
      See Also:
  • Method Details

    • reasonPhrase

      public static String reasonPhrase(int status)
      Returns the RFC 9110 reason phrase for a status listed in this class, or a generic phrase for its class (for example "Client Error") otherwise.
      Parameters:
      status - final status, 200 through 599
      Returns:
      reason phrase
      Throws:
      IllegalArgumentException - if the status is not a final status
    • defaultCode

      public static String defaultCode(int status)
      Returns the default machine-readable error code for a status: its reason phrase in lowercase with spaces replaced by underscores, for example not_found.
      Parameters:
      status - final status
      Returns:
      safe error code