Top Description Methods
org.springframework.web.service.invoker

public Interface HttpExchangeAdapter

Known Direct Subinterfaces
org.springframework.web.service.invoker.ReactorHttpExchangeAdapter
Known Direct Implementers
org.springframework.web.client.support.RestClientAdapter, org.springframework.web.client.support.RestTemplateAdapter
Imports
org.springframework.core.ParameterizedTypeReference, org.springframework.http.HttpHeaders, .ResponseEntity, org.springframework.lang.Nullable

Contract to abstract an HTTP client from HttpServiceProxyFactory and make it pluggable.

For reactive clients, see ReactorHttpExchangeAdapter.

Author
Rossen Stoyanchev
Since
6.1

Method Summary

Modifier and TypeMethod and Description
public void
exchange(HttpRequestValues
the request to perform
requestValues
)

Perform the given request, and release the response content, if any.

public ResponseEntity<Void>

Returns:

the response entity with status and headers.
exchangeForBodilessEntity
(HttpRequestValues requestValues)

Variant of exchange(HttpRequestValues) with additional access to the response status and headers.

public <
the type the response is decoded to
T
>
T

Returns:

the decoded response body.
exchangeForBody
(HttpRequestValues
the request to perform
requestValues
,
ParameterizedTypeReference<T>
the target type to decode to
bodyType
)

Perform the given request and decode the response content to the given type.

public <T> ResponseEntity<T>

Returns:

the response entity with status, headers, and body.
exchangeForEntity
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Variant of exchangeForBody(HttpRequestValues, ParameterizedTypeReference) with additional access to the response status and headers.

public HttpHeaders

Returns:

the response headers
exchangeForHeaders
(HttpRequestValues
the request to perform
requestValues
)

Perform the given request, release the response content, and return the response headers.

public boolean
supportsRequestAttributes()

Whether the underlying client supports use of request attributes.

Method Detail

exchangeback to summary
public void exchange(HttpRequestValues requestValues)

Perform the given request, and release the response content, if any.

Parameters
requestValues:HttpRequestValues

the request to perform

exchangeForBodilessEntityback to summary
public ResponseEntity<Void> exchangeForBodilessEntity(HttpRequestValues requestValues)

Variant of exchange(HttpRequestValues) with additional access to the response status and headers.

Returns:ResponseEntity<Void>

the response entity with status and headers.

exchangeForBodyback to summary
public <T> T exchangeForBody(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Perform the given request and decode the response content to the given type.

Parameters
<T>
the type the response is decoded to
requestValues:HttpRequestValues

the request to perform

bodyType:ParameterizedTypeReference<T>

the target type to decode to

Returns:T

the decoded response body.

Annotations
@Nullable
exchangeForEntityback to summary
public <T> ResponseEntity<T> exchangeForEntity(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Variant of exchangeForBody(HttpRequestValues, ParameterizedTypeReference) with additional access to the response status and headers.

Returns:ResponseEntity<T>

the response entity with status, headers, and body.

exchangeForHeadersback to summary
public HttpHeaders exchangeForHeaders(HttpRequestValues requestValues)

Perform the given request, release the response content, and return the response headers.

Parameters
requestValues:HttpRequestValues

the request to perform

Returns:HttpHeaders

the response headers

supportsRequestAttributesback to summary
public boolean supportsRequestAttributes()

Whether the underlying client supports use of request attributes.