Package org.springframework.web.client
Interface ResponseErrorHandler
- All Known Implementing Classes:
DefaultResponseErrorHandler
public interface ResponseErrorHandler
Strategy interface used by theRestTemplate
to determine whether a particular response has an error or not.- Since:
- 3.0
- Author:
- Arjen Poutsma
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handleError(ClientHttpResponse response)
Handle the error in the given response.boolean
hasError(ClientHttpResponse response)
Indicate whether the given response has any errors.
Method Detail
hasError
boolean hasError(ClientHttpResponse response) throws IOException
Indicate whether the given response has any errors.Implementations will typically inspect the
HttpStatus
of the response.- Parameters:
response
- the response to inspect- Returns:
true
if the response indicates an error;false
otherwise- Throws:
IOException
- in case of I/O errors
handleError
void handleError(ClientHttpResponse response) throws IOException
Handle the error in the given response.This method is only called when
hasError(ClientHttpResponse)
has returnedtrue
.- Parameters:
response
- the response with the error- Throws:
IOException
- in case of I/O errors