Class HttpStatusCodeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.web.client.RestClientException
org.springframework.web.client.RestClientResponseException
org.springframework.web.client.HttpStatusCodeException
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- HttpClientErrorException, HttpServerErrorException
Abstract base class for exceptions based on an 
HttpStatusCode.- Since:
- 3.0
- Author:
- Arjen Poutsma, Chris Beams, Rossen Stoyanchev
- See Also:
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedHttpStatusCodeException(String message, HttpStatusCode statusCode, String statusText, @Nullable HttpHeaders responseHeaders, byte @Nullable [] responseBody, @Nullable Charset responseCharset) Construct instance with anHttpStatusCode, status text, content, and a response charset.protectedHttpStatusCodeException(HttpStatusCode statusCode) Construct a new instance with anHttpStatusCode.protectedHttpStatusCodeException(HttpStatusCode statusCode, String statusText) Construct a new instance with anHttpStatusCodeand status text.protectedHttpStatusCodeException(HttpStatusCode statusCode, String statusText, byte @Nullable [] responseBody, @Nullable Charset responseCharset) Construct instance with anHttpStatusCode, status text, and content.protectedHttpStatusCodeException(HttpStatusCode statusCode, String statusText, @Nullable HttpHeaders responseHeaders, byte @Nullable [] responseBody, @Nullable Charset responseCharset) Construct instance with anHttpStatusCode, status text, content, and a response charset.
- 
Method SummaryMethods inherited from class RestClientResponseExceptiongetResponseBodyAs, getResponseBodyAs, getResponseBodyAsByteArray, getResponseBodyAsString, getResponseBodyAsString, getResponseHeaders, getStatusCode, getStatusText, setBodyConvertFunctionMethods inherited from class NestedRuntimeExceptioncontains, getMostSpecificCause, getRootCauseMethods inherited from class ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
- 
Constructor Details- 
HttpStatusCodeExceptionConstruct a new instance with anHttpStatusCode.- Parameters:
- statusCode- the status code
 
- 
HttpStatusCodeExceptionConstruct a new instance with anHttpStatusCodeand status text.- Parameters:
- statusCode- the status code
- statusText- the status text
 
- 
HttpStatusCodeExceptionprotected HttpStatusCodeException(HttpStatusCode statusCode, String statusText, byte @Nullable [] responseBody, @Nullable Charset responseCharset) Construct instance with anHttpStatusCode, status text, and content.- Parameters:
- statusCode- the status code
- statusText- the status text
- responseBody- the response body content, may be- null
- responseCharset- the response body charset, may be- null
- Since:
- 3.0.5
 
- 
HttpStatusCodeExceptionprotected HttpStatusCodeException(HttpStatusCode statusCode, String statusText, @Nullable HttpHeaders responseHeaders, byte @Nullable [] responseBody, @Nullable Charset responseCharset) Construct instance with anHttpStatusCode, status text, content, and a response charset.- Parameters:
- statusCode- the status code
- statusText- the status text
- responseHeaders- the response headers, may be- null
- responseBody- the response body content, may be- null
- responseCharset- the response body charset, may be- null
- Since:
- 3.1.2
 
- 
HttpStatusCodeExceptionprotected HttpStatusCodeException(String message, HttpStatusCode statusCode, String statusText, @Nullable HttpHeaders responseHeaders, byte @Nullable [] responseBody, @Nullable Charset responseCharset) Construct instance with anHttpStatusCode, status text, content, and a response charset.- Parameters:
- message- the exception message
- statusCode- the status code
- statusText- the status text
- responseHeaders- the response headers, may be- null
- responseBody- the response body content, may be- null
- responseCharset- the response body charset, may be- null
- Since:
- 5.2.2
 
 
-