Class RestClientAdapter
java.lang.Object
org.springframework.web.client.support.RestClientAdapter
- All Implemented Interfaces:
- HttpExchangeAdapter
HttpExchangeAdapter that enables an HttpServiceProxyFactory
 to use RestClient for request execution.
 Use static factory methods in this class to create an
 HttpServiceProxyFactory configured with the given RestClient.
- Since:
- 6.1
- Author:
- Olga Maciaszek-Sharma, Rossen Stoyanchev
- 
Method SummaryModifier and TypeMethodDescriptionstatic RestClientAdaptercreate(RestClient restClient) Create aRestClientAdapterfor the givenRestClient.voidexchange(HttpRequestValues requestValues) Perform the given request, and release the response content, if any.Variant ofHttpExchangeAdapter.exchange(HttpRequestValues)with additional access to the response status and headers.<T> 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.exchangeForHeaders(HttpRequestValues values) Perform the given request, release the response content, and return the response headers.booleanWhether the underlying client supports use of request attributes.
- 
Method Details- 
supportsRequestAttributespublic boolean supportsRequestAttributes()Description copied from interface:HttpExchangeAdapterWhether the underlying client supports use of request attributes.- Specified by:
- supportsRequestAttributesin interface- HttpExchangeAdapter
 
- 
exchangeDescription copied from interface:HttpExchangeAdapterPerform the given request, and release the response content, if any.- Specified by:
- exchangein interface- HttpExchangeAdapter
- Parameters:
- requestValues- the request to perform
 
- 
exchangeForHeadersDescription copied from interface:HttpExchangeAdapterPerform the given request, release the response content, and return the response headers.- Specified by:
- exchangeForHeadersin interface- HttpExchangeAdapter
- Parameters:
- values- the request to perform
- Returns:
- the response headers
 
- 
exchangeForBodyDescription copied from interface:HttpExchangeAdapterPerform the given request and decode the response content to the given type.- Specified by:
- exchangeForBodyin interface- HttpExchangeAdapter
- Type Parameters:
- T- the type the response is decoded to
- Parameters:
- values- the request to perform
- bodyType- the target type to decode to
- Returns:
- the decoded response body.
 
- 
exchangeForBodilessEntityDescription copied from interface:HttpExchangeAdapterVariant ofHttpExchangeAdapter.exchange(HttpRequestValues)with additional access to the response status and headers.- Specified by:
- exchangeForBodilessEntityin interface- HttpExchangeAdapter
- Returns:
- the response entity with status and headers.
 
- 
exchangeForEntitypublic <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 interface- HttpExchangeAdapter
- Returns:
- the response entity with status, headers, and body.
 
- 
createCreate aRestClientAdapterfor the givenRestClient.
 
-