Class NotFoundRestClientAdapterDecorator
java.lang.Object
org.springframework.web.service.invoker.HttpExchangeAdapterDecorator
org.springframework.web.client.support.NotFoundRestClientAdapterDecorator
- All Implemented Interfaces:
HttpExchangeAdapter
HttpExchangeAdapterDecorator that suppresses the
HttpClientErrorException.NotFound exception raised on a 404 response
and returns a ResponseEntity with the status set to
HttpStatus.NOT_FOUND status, or
null from exchangeForBody(HttpRequestValues, ParameterizedTypeReference).- Since:
- 7.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionVariant ofHttpExchangeAdapter.exchange(HttpRequestValues)with additional access to the response status and headers.<T> @nullable TexchangeForBody(HttpRequestValues values, ParameterizedTypeReference<T> bodyType) Perform the given request and decode the response content to the given type.<T> ResponseEntity<T> exchangeForEntity(HttpRequestValues values, ParameterizedTypeReference<T> bodyType) Variant ofHttpExchangeAdapter.exchangeForBody(HttpRequestValues, ParameterizedTypeReference)with additional access to the response status and headers.Methods inherited from class HttpExchangeAdapterDecorator
exchange, exchangeForHeaders, getHttpExchangeAdapter, supportsRequestAttributes
-
Constructor Details
-
NotFoundRestClientAdapterDecorator
-
-
Method Details
-
exchangeForBody
public <T> @nullable T exchangeForBody(HttpRequestValues values, ParameterizedTypeReference<T> bodyType) Description copied from interface:HttpExchangeAdapterPerform the given request and decode the response content to the given type.- Specified by:
exchangeForBodyin interfaceHttpExchangeAdapter- Overrides:
exchangeForBodyin classHttpExchangeAdapterDecorator- Type Parameters:
T- the type the response is decoded to- Parameters:
values- the request to performbodyType- the target type to decode to- Returns:
- the decoded response body.
-
exchangeForBodilessEntity
Description copied from interface:HttpExchangeAdapterVariant ofHttpExchangeAdapter.exchange(HttpRequestValues)with additional access to the response status and headers.- Specified by:
exchangeForBodilessEntityin interfaceHttpExchangeAdapter- Overrides:
exchangeForBodilessEntityin classHttpExchangeAdapterDecorator- Returns:
- the response entity with status and headers.
-
exchangeForEntity
public <T> ResponseEntity<T> exchangeForEntity(HttpRequestValues values, ParameterizedTypeReference<T> bodyType) Description copied from interface:HttpExchangeAdapterVariant ofHttpExchangeAdapter.exchangeForBody(HttpRequestValues, ParameterizedTypeReference)with additional access to the response status and headers.- Specified by:
exchangeForEntityin interfaceHttpExchangeAdapter- Overrides:
exchangeForEntityin classHttpExchangeAdapterDecorator- Returns:
- the response entity with status, headers, and body.
-