Interface HttpExchangeAdapter
- All Known Subinterfaces:
ReactorHttpExchangeAdapter
- All Known Implementing Classes:
AbstractReactorHttpExchangeAdapter
,RestClientAdapter
,RestTemplateAdapter
,WebClientAdapter
public interface HttpExchangeAdapter
Contract to abstract an HTTP client from HttpServiceProxyFactory
and make it pluggable.
For reactive clients, see ReactorHttpExchangeAdapter
.
- Since:
- 6.1
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionvoid
exchange
(HttpRequestValues requestValues) Perform the given request, and release the response content, if any.exchangeForBodilessEntity
(HttpRequestValues requestValues) Variant ofexchange(HttpRequestValues)
with additional access to the response status and headers.<T> T
exchangeForBody
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Perform the given request and decode the response content to the given type.<T> ResponseEntity<T>
exchangeForEntity
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Variant ofexchangeForBody(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers.exchangeForHeaders
(HttpRequestValues requestValues) Perform the given request, release the response content, and return the response headers.boolean
Whether the underlying client supports use of request attributes.
-
Method Details
-
supportsRequestAttributes
boolean supportsRequestAttributes()Whether the underlying client supports use of request attributes. -
exchange
Perform the given request, and release the response content, if any.- Parameters:
requestValues
- the request to perform
-
exchangeForHeaders
Perform the given request, release the response content, and return the response headers.- Parameters:
requestValues
- the request to perform- Returns:
- the response headers
-
exchangeForBody
@Nullable <T> T exchangeForBody(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Perform the given request and decode the response content to the given type.- Type Parameters:
T
- the type the response is decoded to- Parameters:
requestValues
- the request to performbodyType
- the target type to decode to- Returns:
- the decoded response body.
-
exchangeForBodilessEntity
Variant ofexchange(HttpRequestValues)
with additional access to the response status and headers.- Returns:
- the response entity with status and headers.
-
exchangeForEntity
<T> ResponseEntity<T> exchangeForEntity(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Variant ofexchangeForBody(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers.- Returns:
- the response entity with status, headers, and body.
-