public interface ResponseErrorHandler
RestTemplate
to determine
whether a particular response has an error or not.Modifier and Type | Method and Description |
---|---|
void |
handleError(ClientHttpResponse response)
Handle the error in the given response.
|
default void |
handleError(java.net.URI url,
HttpMethod method,
ClientHttpResponse response)
Alternative to
handleError(ClientHttpResponse) with extra
information providing access to the request URL and HTTP method. |
boolean |
hasError(ClientHttpResponse response)
Indicate whether the given response has any errors.
|
boolean hasError(ClientHttpResponse response) throws java.io.IOException
Implementations will typically inspect the
HttpStatus
of the response.
response
- the response to inspecttrue
if the response indicates an error; false
otherwisejava.io.IOException
- in case of I/O errorsvoid handleError(ClientHttpResponse response) throws java.io.IOException
This method is only called when hasError(ClientHttpResponse)
has returned true
.
response
- the response with the errorjava.io.IOException
- in case of I/O errorsdefault void handleError(java.net.URI url, HttpMethod method, ClientHttpResponse response) throws java.io.IOException
handleError(ClientHttpResponse)
with extra
information providing access to the request URL and HTTP method.url
- the request URLmethod
- the HTTP methodresponse
- the response with the errorjava.io.IOException
- in case of I/O errors