Top Description Fields Constructors Methods
org.springframework.web.reactive.function.client.support

public final Class WebClientAdapter

extends AbstractReactorHttpExchangeAdapter
Class Inheritance
Imports
java.net.URI, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, org.springframework.core.ParameterizedTypeReference, org.springframework.http.HttpHeaders, .HttpMethod, .ResponseEntity, org.springframework.util.Assert, org.springframework.web.reactive.function.client.WebClient, org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter, .HttpRequestValues, .HttpServiceProxyFactory, .ReactiveHttpRequestValues, .ReactorHttpExchangeAdapter, org.springframework.web.util.UriBuilderFactory

References Deprecated

AbstractReactorHttpExchangeAdapter is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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.

Author
Rossen Stoyanchev
Since
6.0

Field Summary

Modifier and TypeField and Description
private final WebClient

Constructor Summary

AccessConstructor and Description
private
WebClientAdapter(WebClient webClient)

Package private constructor.

Method Summary

Modifier and TypeMethod and Description
public static WebClientAdapter

Returns:

the created adapter instance
create
(WebClient
the client to use
webClient
)
References Deprecated WebClientAdapter is deprecated or references (maybe indirectly) at least one deprecated element.

Create a WebClientAdapter for the given WebClient instance.

public Mono<ResponseEntity<Void>>
public <T> Flux<T>
exchangeForBodyFlux(HttpRequestValues
the request to perform
requestValues
,
ParameterizedTypeReference<T>
the target stream element type to decode to
bodyType
)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodyFlux.

Perform the given request and decode the response content to a stream with elements of the given type.

public <T> Mono<T>
exchangeForBodyMono(HttpRequestValues
the request to perform
requestValues
,
ParameterizedTypeReference<T>
the target type to decode to
bodyType
)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodyMono.

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

public <T> Mono<ResponseEntity<Flux<T>>>
public <T> Mono<ResponseEntity<T>>
public Mono<HttpHeaders>
exchangeForHeadersMono(HttpRequestValues
the request to perform
requestValues
)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForHeadersMono.

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

public Mono<Void>
exchangeForMono(HttpRequestValues
the request to perform
requestValues
)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForMono.

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

public static WebClientAdapter

Returns:

the created adapter instance
forClient
(WebClient
the client to use
webClient
)
Deprecated for removal since 6.1. in favor of create(WebClient) aligning with other adapter implementations; to be removed in 6.2.

Create a WebClientAdapter for the given WebClient instance.

private WebClient.RequestBodySpec
public boolean
supportsRequestAttributes()

Implements org.springframework.web.service.invoker.HttpExchangeAdapter.supportsRequestAttributes.

Whether the underlying client supports use of request attributes.

Inherited from org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter:
exchangeexchangeForBodilessEntityexchangeForBodyexchangeForEntityexchangeForHeadersgetBlockTimeoutgetReactiveAdapterRegistryrequestToBodilessEntityrequestToBodyrequestToBodyFluxrequestToEntityrequestToEntityFluxrequestToHeadersrequestToVoidsetBlockTimeoutsetReactiveAdapterRegistry

Field Detail

webClientback to summary
private final WebClient webClient

Constructor Detail

WebClientAdapterback to summary
private WebClientAdapter(WebClient webClient)

Package private constructor. See static factory methods.

Method Detail

createback to summary
public static WebClientAdapter create(WebClient webClient)

References Deprecated

WebClientAdapter is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a WebClientAdapter for the given WebClient instance.

Parameters
webClient:WebClient

the client to use

Returns:WebClientAdapter

the created adapter instance

Since
6.1
exchangeForBodilessEntityMonoback to summary
public Mono<ResponseEntity<Void>> exchangeForBodilessEntityMono(HttpRequestValues requestValues)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodilessEntityMono.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodilessEntityMono.

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

Annotations
@Override
exchangeForBodyFluxback to summary
public <T> Flux<T> exchangeForBodyFlux(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodyFlux.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodyFlux.

Perform the given request and decode the response content to a stream with elements of the given type.

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

the request to perform

bodyType:ParameterizedTypeReference<T>

the target stream element type to decode to

Returns:Flux<T>

Flux with decoded stream elements.

Annotations
@Override
exchangeForBodyMonoback to summary
public <T> Mono<T> exchangeForBodyMono(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodyMono.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForBodyMono.

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:Mono<T>

Mono that returns the decoded response.

Annotations
@Override
exchangeForEntityFluxback to summary
public <T> Mono<ResponseEntity<Flux<T>>> exchangeForEntityFlux(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForEntityFlux.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForEntityFlux.

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

Annotations
@Override
exchangeForEntityMonoback to summary
public <T> Mono<ResponseEntity<T>> exchangeForEntityMono(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForEntityMono.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForEntityMono.

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

Annotations
@Override
exchangeForHeadersMonoback to summary
public Mono<HttpHeaders> exchangeForHeadersMono(HttpRequestValues requestValues)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForHeadersMono.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForHeadersMono.

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

Parameters
requestValues:HttpRequestValues

the request to perform

Returns:Mono<HttpHeaders>

Mono that returns the response headers the request is fully executed and the response content released.

Annotations
@Override
exchangeForMonoback to summary
public Mono<Void> exchangeForMono(HttpRequestValues requestValues)

Implements org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForMono.

Doc from org.springframework.web.service.invoker.ReactorHttpExchangeAdapter.exchangeForMono.

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

Parameters
requestValues:HttpRequestValues

the request to perform

Returns:Mono<Void>

Mono that completes when the request is fully executed and the response content is released.

Annotations
@Override
forClientback to summary
public static WebClientAdapter forClient(WebClient webClient)

Deprecated

for removal since 6.1.

in favor of create(WebClient) aligning with other adapter implementations; to be removed in 6.2.

Create a WebClientAdapter for the given WebClient instance.

Parameters
webClient:WebClient

the client to use

Returns:WebClientAdapter

the created adapter instance

Annotations
@Deprecated
since:6.1
forRemoval:true
newRequestback to summary
private WebClient.RequestBodySpec newRequest(HttpRequestValues values)
Annotations
@SuppressWarnings:ReactiveStreamsUnusedPublisher
supportsRequestAttributesback to summary
public boolean supportsRequestAttributes()

Implements org.springframework.web.service.invoker.HttpExchangeAdapter.supportsRequestAttributes.

Doc from org.springframework.web.service.invoker.HttpExchangeAdapter.supportsRequestAttributes.

Whether the underlying client supports use of request attributes.

Annotations
@Override