Package org.springframework.web.client
Class HttpStatusCodeException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
HttpClientErrorException
,HttpServerErrorException
public abstract class HttpStatusCodeException extends RestClientResponseException
Abstract base class for exceptions based on anHttpStatus
.- Since:
- 3.0
- Author:
- Arjen Poutsma, Chris Beams, Rossen Stoyanchev
- See Also:
- Serialized Form
Constructor Summary
Constructors Modifier Constructor Description protected
HttpStatusCodeException(HttpStatus statusCode)
Construct a new instance with anHttpStatus
.protected
HttpStatusCodeException(HttpStatus statusCode, String statusText)
Construct a new instance with anHttpStatus
and status text.protected
HttpStatusCodeException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)
Construct instance with anHttpStatus
, status text, and content.protected
HttpStatusCodeException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)
Construct instance with anHttpStatus
, status text, content, and a response charset.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpStatus
getStatusCode()
Return the HTTP status code.Methods inherited from class org.springframework.web.client.RestClientResponseException
getRawStatusCode, getResponseBodyAsByteArray, getResponseBodyAsString, getResponseHeaders, getStatusText
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Constructor Detail
HttpStatusCodeException
protected HttpStatusCodeException(HttpStatus statusCode)
Construct a new instance with anHttpStatus
.- Parameters:
statusCode
- the status code
HttpStatusCodeException
protected HttpStatusCodeException(HttpStatus statusCode, String statusText)
Construct a new instance with anHttpStatus
and status text.- Parameters:
statusCode
- the status codestatusText
- the status text
HttpStatusCodeException
protected HttpStatusCodeException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)
Construct instance with anHttpStatus
, status text, and content.- Parameters:
statusCode
- the status codestatusText
- the status textresponseBody
- the response body content, may benull
responseCharset
- the response body charset, may benull
- Since:
- 3.0.5
HttpStatusCodeException
protected HttpStatusCodeException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)
Construct instance with anHttpStatus
, status text, content, and a response charset.- Parameters:
statusCode
- the status codestatusText
- the status textresponseHeaders
- the response headers, may benull
responseBody
- the response body content, may benull
responseCharset
- the response body charset, may benull
- Since:
- 3.1.2
Method Detail
getStatusCode
public HttpStatus getStatusCode()
Return the HTTP status code.