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 Details

    • supportsRequestAttributes

      boolean supportsRequestAttributes()
      Whether the underlying client supports use of request attributes.
    • exchange

      void exchange(HttpRequestValues requestValues)
      Perform the given request, and release the response content, if any.
      Parameters:
      requestValues - the request to perform
    • exchangeForHeaders

      HttpHeaders exchangeForHeaders(HttpRequestValues requestValues)
      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 perform
      bodyType - the target type to decode to
      Returns:
      the decoded response body.
    • exchangeForBodilessEntity

      ResponseEntity<Void> exchangeForBodilessEntity(HttpRequestValues requestValues)
      Variant of exchange(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 of exchangeForBody(HttpRequestValues, ParameterizedTypeReference) with additional access to the response status and headers.
      Returns:
      the response entity with status, headers, and body.