Class HttpStatus

java.lang.Object
org.eclipse.jetty.http.HttpStatus

public class HttpStatus extends Object

Http Status Codes

See Also:
  • Field Details

  • Constructor Details

    • HttpStatus

      public HttpStatus()
  • Method Details

    • getCode

      public static HttpStatus.Code getCode(int code)
      Get the HttpStatus.Code for a specific code.
      Parameters:
      code - the code to lookup.
      Returns:
      the HttpStatus.Code if found, or null if not found.
    • getMessage

      public static String getMessage(int code)
      Get the status message for a specific code.
      Parameters:
      code - the code to look up
      Returns:
      the specific message, or the code number itself if code does not match known list.
    • hasNoBody

      public static boolean hasNoBody(int status)
    • isInformational

      public static boolean isInformational(int code)
      Tests whether the status code is of the Informational message category as defined in RFC 9110.
      Parameters:
      code - the code to test.
      Returns:
      true if within range of codes that belongs to Informational codes.
    • isInterim

      public static boolean isInterim(int code)
      Tests whether the status code is informational but not 101 Switching Protocols.
      Parameters:
      code - the code to test
      Returns:
      whether the status code is informational but not 101 Switching Protocols
    • isSuccess

      public static boolean isSuccess(int code)
      Tests whether the status code is of the Successful message category as defined in RFC 9110.
      Parameters:
      code - the code to test.
      Returns:
      true if within range of codes that belongs to Successful codes.
    • isRedirection

      public static boolean isRedirection(int code)
      Tests whether the status code is of the Redirection message category as defined in RFC 9110.
      Parameters:
      code - the code to test.
      Returns:
      true if within range of codes that belongs to Redirection codes.
    • isError

      public static boolean isError(int code)
      Tests whether the status code is either a client error or a server error.
      Parameters:
      code - the code to test
      Returns:
      whether the status code is either a client error or a server error
    • isClientError

      public static boolean isClientError(int code)
      Tests whether the status code is of the Client Error message category as defined in RFC 9110.
      Parameters:
      code - the code to test.
      Returns:
      true if within range of codes that belongs to Client Error codes.
    • isServerError

      public static boolean isServerError(int code)
      Tests whether the status code is of the Server Error message category as defined in RFC 9110.
      Parameters:
      code - the code to test.
      Returns:
      true if within range of codes that belongs to Server Error codes.