Package org.springframework.http
Interface HttpStatusCode
- All Superinterfaces:
- Serializable
- All Known Implementing Classes:
- HttpStatus
Represents an HTTP response status code. Implemented by 
HttpStatus,
 but defined as an interface to allow for values not in that enumeration.- Since:
- 6.0
- Author:
- Arjen Poutsma
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleanWhether this status code is in the Informational class (1xx).booleanWhether this status code is in the Successful class (2xx).booleanWhether this status code is in the Redirection class (3xx).booleanWhether this status code is in the Client Error class (4xx).booleanWhether this status code is in the Server Error class (5xx).booleanisError()Whether this status code is in the Client or Server Error classdefault booleanisSameCodeAs(HttpStatusCode other) Whether thisHttpStatusCodeshares the same integervalueas the other status code.intvalue()Return the integer value of this status code.static HttpStatusCodevalueOf(int code) Return anHttpStatusCodeobject for the given integer value.
- 
Method Details- 
valueint value()Return the integer value of this status code.
- 
is1xxInformationalboolean is1xxInformational()Whether this status code is in the Informational class (1xx).- See Also:
 
- 
is2xxSuccessfulboolean is2xxSuccessful()Whether this status code is in the Successful class (2xx).- See Also:
 
- 
is3xxRedirectionboolean is3xxRedirection()Whether this status code is in the Redirection class (3xx).- See Also:
 
- 
is4xxClientErrorboolean is4xxClientError()Whether this status code is in the Client Error class (4xx).- See Also:
 
- 
is5xxServerErrorboolean is5xxServerError()Whether this status code is in the Server Error class (5xx).- See Also:
 
- 
isErrorboolean isError()Whether this status code is in the Client or Server Error class- See Also:
- 
- RFC 2616
- RFC 2616
 (4xxor5xx).
- is4xxClientError()
- is5xxServerError()
 
 
- 
isSameCodeAsWhether thisHttpStatusCodeshares the same integervalueas the other status code.Useful for comparisons that take deprecated aliases into account or compare arbitrary implementations of HttpStatusCode(for example, in place ofHttpStatus enum equality).- Parameters:
- other- the other- HttpStatusCodeto compare
- Returns:
- true if the two HttpStatusCodeobjects share the same integervalue(), false otherwise
- Since:
- 6.0.5
 
- 
valueOfReturn anHttpStatusCodeobject for the given integer value.- Parameters:
- code- the status code as integer
- Returns:
- the corresponding HttpStatusCode
- Throws:
- IllegalArgumentException- if- codeis not a three-digit positive number
 
 
-