Package org.springframework.web.client
Class HttpClientErrorException
- All Implemented Interfaces:
Serializable
public class HttpClientErrorException extends HttpStatusCodeException
Exception thrown when an HTTP 4xx is received.- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
DefaultResponseErrorHandler
, Serialized Form
Constructor Summary
Constructors Constructor Description HttpClientErrorException(HttpStatus statusCode)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
.HttpClientErrorException(HttpStatus statusCode, String statusText)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
and status text.HttpClientErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
, status text, and response body content.HttpClientErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
, status text, and response body content.
Method Summary
Methods inherited from class org.springframework.web.client.HttpStatusCodeException
getStatusCode
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
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
.- Parameters:
statusCode
- the status code
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
and status text.- Parameters:
statusCode
- the status codestatusText
- the status text
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText, byte[] responseBody, Charset responseCharset)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
, status text, and response body content.- Parameters:
statusCode
- the status codestatusText
- the status textresponseBody
- the response body content (may benull
)responseCharset
- the response body charset (may benull
)
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset)
Construct a new instance ofHttpClientErrorException
based on anHttpStatus
, status text, and response body content.- 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