Package org.springframework.web.client
Class HttpClientErrorException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
HttpClientErrorException.BadRequest
,HttpClientErrorException.Conflict
,HttpClientErrorException.Forbidden
,HttpClientErrorException.Gone
,HttpClientErrorException.MethodNotAllowed
,HttpClientErrorException.NotAcceptable
,HttpClientErrorException.NotFound
,HttpClientErrorException.TooManyRequests
,HttpClientErrorException.Unauthorized
,HttpClientErrorException.UnprocessableEntity
,HttpClientErrorException.UnsupportedMediaType
public class HttpClientErrorException extends HttpStatusCodeException
Exception thrown when an HTTP 4xx is received.- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
DefaultResponseErrorHandler
, Serialized Form
Nested Class Summary
Constructor Summary
Constructors Constructor Description HttpClientErrorException(String message, HttpStatus statusCode, String statusText, HttpHeaders headers, byte[] body, Charset responseCharset)
Constructor with a status code and status text, headers, and content, and an prepared message.HttpClientErrorException(HttpStatus statusCode)
Constructor with a status code only.HttpClientErrorException(HttpStatus statusCode, String statusText)
Constructor with a status code and status text.HttpClientErrorException(HttpStatus statusCode, String statusText, byte[] body, Charset responseCharset)
Constructor with a status code and status text, and content.HttpClientErrorException(HttpStatus statusCode, String statusText, HttpHeaders headers, byte[] body, Charset responseCharset)
Constructor with a status code and status text, headers, and content.
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpClientErrorException
create(String message, HttpStatus statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset)
Variant ofcreate(HttpStatus, String, HttpHeaders, byte[], Charset)
with an optional prepared message.static HttpClientErrorException
create(HttpStatus statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset)
CreateHttpClientErrorException
or an HTTP status specific sub-class.Methods inherited from class org.springframework.web.client.HttpStatusCodeException
getStatusCode
Methods inherited from class org.springframework.web.client.RestClientResponseException
getRawStatusCode, getResponseBodyAsByteArray, getResponseBodyAsString, 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)
Constructor with a status code only.
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText)
Constructor with a status code and status text.
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText, @Nullable byte[] body, @Nullable Charset responseCharset)
Constructor with a status code and status text, and content.
HttpClientErrorException
public HttpClientErrorException(HttpStatus statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset responseCharset)
Constructor with a status code and status text, headers, and content.
HttpClientErrorException
public HttpClientErrorException(String message, HttpStatus statusCode, String statusText, @Nullable HttpHeaders headers, @Nullable byte[] body, @Nullable Charset responseCharset)
Constructor with a status code and status text, headers, and content, and an prepared message.- Since:
- 5.2.2
Method Detail
create
public static HttpClientErrorException create(HttpStatus statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset)
CreateHttpClientErrorException
or an HTTP status specific sub-class.- Since:
- 5.1
create
public static HttpClientErrorException create(@Nullable String message, HttpStatus statusCode, String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset)
Variant ofcreate(HttpStatus, String, HttpHeaders, byte[], Charset)
with an optional prepared message.- Since:
- 5.2.2