接口 HttpStatusCode

所有超级接口:
Serializable
所有已知实现类:
HttpStatus, SimpleHttpStatusCode

public interface HttpStatusCode extends Serializable
Represents an HTTP response status code. Implemented by HttpStatus, but defined as an interface to allow for values not in that enumeration.
从以下版本开始:
4.0 2022/4/1 21:31
作者:
Arjen Poutsma, Harry Yang
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    boolean
    Whether this status code is in the Informational class (1xx).
    boolean
    Whether this status code is in the Successful class (2xx).
    boolean
    Whether this status code is in the Redirection class (3xx).
    boolean
    Whether this status code is in the Client Error class (4xx).
    boolean
    Whether this status code is in the Server Error class (5xx).
    boolean
    Whether this status code is in the Client or Server Error class
    default boolean
    Whether this HttpStatusCode shares the same integer value as the other status code.
    int
    Return the integer value of this status code.
    valueOf(int code)
    Return an HttpStatusCode object for the given integer value.
  • 方法详细资料

    • value

      int value()
      Return the integer value of this status code.
    • is1xxInformational

      boolean is1xxInformational()
      Whether this status code is in the Informational class (1xx).
      另请参阅:
    • is2xxSuccessful

      boolean is2xxSuccessful()
      Whether this status code is in the Successful class (2xx).
      另请参阅:
    • is3xxRedirection

      boolean is3xxRedirection()
      Whether this status code is in the Redirection class (3xx).
      另请参阅:
    • is4xxClientError

      boolean is4xxClientError()
      Whether this status code is in the Client Error class (4xx).
      另请参阅:
    • is5xxServerError

      boolean is5xxServerError()
      Whether this status code is in the Server Error class (5xx).
      另请参阅:
    • isError

      boolean isError()
      Whether this status code is in the Client or Server Error class
      另请参阅:
    • isSameCodeAs

      default boolean isSameCodeAs(HttpStatusCode other)
      Whether this HttpStatusCode shares the same integer value as the other status code.

      Useful for comparisons that take deprecated aliases into account or compare arbitrary implementations of HttpStatusCode (e.g. in place of HttpStatus enum equality).

      参数:
      other - the other HttpStatusCode to compare
      返回:
      true if the two HttpStatusCode share the same integer value(), false otherwise
    • valueOf

      static HttpStatusCode valueOf(int code)
      Return an HttpStatusCode object for the given integer value.
      参数:
      code - the status code as integer
      返回:
      the corresponding HttpStatusCode
      抛出:
      IllegalArgumentException - if code is not a three-digit positive number