Class ExtractingResponseErrorHandler

java.lang.Object
org.springframework.web.client.DefaultResponseErrorHandler
org.springframework.web.client.ExtractingResponseErrorHandler
All Implemented Interfaces:
ResponseErrorHandler

public class ExtractingResponseErrorHandler extends DefaultResponseErrorHandler
Implementation of ResponseErrorHandler that uses HttpMessageConverters to convert HTTP error responses to RestClientExceptions.

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, DefaultResponseErrorHandler.hasError(ClientHttpResponse) will return true, and DefaultResponseErrorHandler.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.

Since:
5.0
Author:
Simon Galperin, Arjen Poutsma
See Also: