Class WebClientAdapter
java.lang.Object
org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter
org.springframework.web.reactive.function.client.support.WebClientAdapter
- All Implemented Interfaces:
HttpClientAdapter
,HttpExchangeAdapter
,ReactorHttpExchangeAdapter
ReactorHttpExchangeAdapter
that enables an HttpServiceProxyFactory
to use WebClient
for request execution.
Use static factory methods in this class to create an
HttpServiceProxyFactory
configured with a given WebClient
.
- Since:
- 6.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionstatic WebClientAdapter
Create aWebClientAdapter
for the givenWebClient
instance.reactor.core.publisher.Mono<ResponseEntity<Void>>
exchangeForBodilessEntityMono
(HttpRequestValues requestValues) Variant ofReactorHttpExchangeAdapter.exchangeForMono(HttpRequestValues)
with additional access to the response status and headers.<T> reactor.core.publisher.Flux<T>
exchangeForBodyFlux
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Perform the given request and decode the response content to a stream with elements of the given type.<T> reactor.core.publisher.Mono<T>
exchangeForBodyMono
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Perform the given request and decode the response content to the given type.<T> reactor.core.publisher.Mono<ResponseEntity<reactor.core.publisher.Flux<T>>>
exchangeForEntityFlux
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Variant ofReactorHttpExchangeAdapter.exchangeForBodyFlux(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers.<T> reactor.core.publisher.Mono<ResponseEntity<T>>
exchangeForEntityMono
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Variant ofReactorHttpExchangeAdapter.exchangeForBodyMono(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers.reactor.core.publisher.Mono<HttpHeaders>
exchangeForHeadersMono
(HttpRequestValues requestValues) Perform the given request, release the response content, and return the response headers.reactor.core.publisher.Mono<Void>
exchangeForMono
(HttpRequestValues requestValues) Perform the given request, and release the response content, if any.boolean
Whether the underlying client supports use of request attributes.Methods inherited from class org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter
exchange, exchangeForBodilessEntity, exchangeForBody, exchangeForEntity, exchangeForHeaders, getBlockTimeout, getReactiveAdapterRegistry, requestToBodilessEntity, requestToBody, requestToBodyFlux, requestToEntity, requestToEntityFlux, requestToHeaders, requestToVoid, setBlockTimeout, setReactiveAdapterRegistry
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.service.invoker.HttpClientAdapter
asReactorExchangeAdapter
-
Method Details
-
supportsRequestAttributes
public boolean supportsRequestAttributes()Description copied from interface:HttpExchangeAdapter
Whether the underlying client supports use of request attributes. -
exchangeForMono
Description copied from interface:ReactorHttpExchangeAdapter
Perform the given request, and release the response content, if any.- Parameters:
requestValues
- the request to perform- Returns:
Mono
that completes when the request is fully executed and the response content is released.
-
exchangeForHeadersMono
public reactor.core.publisher.Mono<HttpHeaders> exchangeForHeadersMono(HttpRequestValues requestValues) Description copied from interface:ReactorHttpExchangeAdapter
Perform the given request, release the response content, and return the response headers.- Parameters:
requestValues
- the request to perform- Returns:
Mono
that returns the response headers the request is fully executed and the response content released.
-
exchangeForBodyMono
public <T> reactor.core.publisher.Mono<T> exchangeForBodyMono(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Description copied from interface:ReactorHttpExchangeAdapter
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:
Mono
that returns the decoded response.
-
exchangeForBodyFlux
public <T> reactor.core.publisher.Flux<T> exchangeForBodyFlux(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Description copied from interface:ReactorHttpExchangeAdapter
Perform the given request and decode the response content to a stream with elements of the given type.- Type Parameters:
T
- the type the response is decoded to- Parameters:
requestValues
- the request to performbodyType
- the target stream element type to decode to- Returns:
Flux
with decoded stream elements.
-
exchangeForBodilessEntityMono
public reactor.core.publisher.Mono<ResponseEntity<Void>> exchangeForBodilessEntityMono(HttpRequestValues requestValues) Description copied from interface:ReactorHttpExchangeAdapter
Variant ofReactorHttpExchangeAdapter.exchangeForMono(HttpRequestValues)
with additional access to the response status and headers. -
exchangeForEntityMono
public <T> reactor.core.publisher.Mono<ResponseEntity<T>> exchangeForEntityMono(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Description copied from interface:ReactorHttpExchangeAdapter
Variant ofReactorHttpExchangeAdapter.exchangeForBodyMono(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers. -
exchangeForEntityFlux
public <T> reactor.core.publisher.Mono<ResponseEntity<reactor.core.publisher.Flux<T>>> exchangeForEntityFlux(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) Description copied from interface:ReactorHttpExchangeAdapter
Variant ofReactorHttpExchangeAdapter.exchangeForBodyFlux(HttpRequestValues, ParameterizedTypeReference)
with additional access to the response status and headers. -
create
Create aWebClientAdapter
for the givenWebClient
instance.- Parameters:
webClient
- the client to use- Returns:
- the created adapter instance
- Since:
- 6.1
-