open class ExtractingResponseErrorHandler : DefaultResponseErrorHandler
Implementation of ResponseErrorHandler that uses HttpMessageConverters to convert HTTP error responses to RestClientException.
To use this error handler, you must specify a status mapping and/or a series mapping. If either of these mappings has a match for the status code of a given ClientHttpResponse, #hasError(ClientHttpResponse) will return true and #handleError(ClientHttpResponse) will attempt to use the configured message converters to convert the response into the mapped subclass of RestClientException. Note that the status mapping takes precedence over series mapping.
If there is no match, this error handler will default to the behavior of DefaultResponseErrorHandler. Note that you can override this default behavior by specifying a series mapping from HttpStatus.Series#CLIENT_ERROR and/or HttpStatus.Series#SERVER_ERROR to null.
Author
Simon Galperin
Author
Arjen Poutsma
Since
5.0
See Also
RestTemplate#setErrorHandler(ResponseErrorHandler)
ExtractingResponseErrorHandler()
Create a new, empty Note that ExtractingResponseErrorHandler(messageConverters: MutableList<HttpMessageConverter<*>>)
Create a new |
open fun handleError(response: ClientHttpResponse, statusCode: HttpStatus): Unit |
|
open fun setMessageConverters(messageConverters: MutableList<HttpMessageConverter<*>>): Unit
Set the message converters to use by this extractor. |
|
open fun setSeriesMapping(seriesMapping: MutableMap<Series, Class<out RestClientException>>): Unit
Set the mapping from HTTP status series to |
|
open fun setStatusMapping(statusMapping: MutableMap<HttpStatus, Class<out RestClientException>>): Unit
Set the mapping from HTTP status code to |