|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.client.DefaultResponseErrorHandler
public class DefaultResponseErrorHandler
Default implementation of the ResponseErrorHandler
interface.
This error handler checks for the status code on the ClientHttpResponse
: any code with series
HttpStatus.Series.CLIENT_ERROR
or
HttpStatus.Series.SERVER_ERROR
is considered to be an error.
This behavior can be changed by overriding the hasError(HttpStatus)
method.
RestTemplate.setErrorHandler(org.springframework.web.client.ResponseErrorHandler)
Constructor Summary | |
---|---|
DefaultResponseErrorHandler()
|
Method Summary | |
---|---|
void |
handleError(ClientHttpResponse response)
This default implementation throws a HttpClientErrorException if the response status code
is HttpStatus.Series.CLIENT_ERROR , a HttpServerErrorException
if it is HttpStatus.Series.SERVER_ERROR ,
and a RestClientException in other cases. |
boolean |
hasError(ClientHttpResponse response)
Delegates to hasError(HttpStatus) with the response status code. |
protected boolean |
hasError(HttpStatus statusCode)
Template method called from hasError(ClientHttpResponse) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultResponseErrorHandler()
Method Detail |
---|
public boolean hasError(ClientHttpResponse response) throws IOException
hasError(HttpStatus)
with the response status code.
hasError
in interface ResponseErrorHandler
response
- the response to inspect
true
if the response has an error; false
otherwise
IOException
- in case of I/O errorsprotected boolean hasError(HttpStatus statusCode)
hasError(ClientHttpResponse)
.
The default implementation checks if the given status code is
CLIENT_ERROR
or SERVER_ERROR
.
Can be overridden in subclasses.
statusCode
- the HTTP status code
true
if the response has an error; false
otherwisepublic void handleError(ClientHttpResponse response) throws IOException
HttpClientErrorException
if the response status code
is HttpStatus.Series.CLIENT_ERROR
, a HttpServerErrorException
if it is HttpStatus.Series.SERVER_ERROR
,
and a RestClientException
in other cases.
handleError
in interface ResponseErrorHandler
response
- the response with the error
IOException
- in case of I/O errors
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |