Top Description Methods
org.springframework.web.client

public Interface ResponseErrorHandler

Known Direct Implementers
org.springframework.web.client.DefaultResponseErrorHandler
Imports
java.io.IOException, java.net.URI, org.springframework.http.HttpMethod, org.springframework.http.client.ClientHttpResponse

Strategy interface used by the RestTemplate to determine whether a particular response has an error or not.
Author
Arjen Poutsma
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public void
handleError(ClientHttpResponse
the response with the error
response
)

Handle the error in the given response.

public default void
handleError(URI
the request URL
url
,
HttpMethod
the HTTP method
method
,
ClientHttpResponse
the response with the error
response
)

Alternative to handleError(ClientHttpResponse) with extra information providing access to the request URL and HTTP method.

public boolean

Returns:

true if the response indicates an error; false otherwise
hasError
(ClientHttpResponse
the response to inspect
response
)

Indicate whether the given response has any errors.

Method Detail

handleErrorback to summary
public void handleError(ClientHttpResponse response) throws IOException

Handle the error in the given response.

This method is only called when hasError(ClientHttpResponse) has returned true.

Parameters
response:ClientHttpResponse

the response with the error

Exceptions
IOException:
in case of I/O errors
handleErrorback to summary
public default void handleError(URI url, HttpMethod method, ClientHttpResponse response) throws IOException

Alternative to handleError(ClientHttpResponse) with extra information providing access to the request URL and HTTP method.

Parameters
url:URI

the request URL

method:HttpMethod

the HTTP method

response:ClientHttpResponse

the response with the error

Exceptions
IOException:
in case of I/O errors
Since
5.0
hasErrorback to summary
public 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:ClientHttpResponse

the response to inspect

Returns:boolean

true if the response indicates an error; false otherwise

Exceptions
IOException:
in case of I/O errors