java.lang.Object
org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter
org.springframework.web.reactive.function.client.support.WebClientAdapter
All Implemented Interfaces:
org.springframework.web.service.invoker.HttpClientAdapter, org.springframework.web.service.invoker.HttpExchangeAdapter, org.springframework.web.service.invoker.ReactorHttpExchangeAdapter

public final class WebClientAdapter extends org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter
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 Type
    Method
    Description
    create(WebClient webClient)
    Create a WebClientAdapter for the given WebClient instance.
    reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Void>>
    exchangeForBodilessEntityMono(org.springframework.web.service.invoker.HttpRequestValues requestValues)
     
    <T> reactor.core.publisher.Flux<T>
    exchangeForBodyFlux(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
     
    <T> reactor.core.publisher.Mono<T>
    exchangeForBodyMono(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
     
    <T> reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<T>>>
    exchangeForEntityFlux(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
     
    <T> reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<T>>
    exchangeForEntityMono(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
     
    reactor.core.publisher.Mono<org.springframework.http.HttpHeaders>
    exchangeForHeadersMono(org.springframework.web.service.invoker.HttpRequestValues requestValues)
     
    reactor.core.publisher.Mono<Void>
    exchangeForMono(org.springframework.web.service.invoker.HttpRequestValues requestValues)
     
    forClient(WebClient webClient)
    Deprecated, for removal: This API element is subject to removal in a future version.
    in favor of create(WebClient) aligning with other adapter implementations; to be removed in 6.2.
    boolean
     

    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()
    • exchangeForMono

      public reactor.core.publisher.Mono<Void> exchangeForMono(org.springframework.web.service.invoker.HttpRequestValues requestValues)
    • exchangeForHeadersMono

      public reactor.core.publisher.Mono<org.springframework.http.HttpHeaders> exchangeForHeadersMono(org.springframework.web.service.invoker.HttpRequestValues requestValues)
    • exchangeForBodyMono

      public <T> reactor.core.publisher.Mono<T> exchangeForBodyMono(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
    • exchangeForBodyFlux

      public <T> reactor.core.publisher.Flux<T> exchangeForBodyFlux(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
    • exchangeForBodilessEntityMono

      public reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Void>> exchangeForBodilessEntityMono(org.springframework.web.service.invoker.HttpRequestValues requestValues)
    • exchangeForEntityMono

      public <T> reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<T>> exchangeForEntityMono(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
    • exchangeForEntityFlux

      public <T> reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<T>>> exchangeForEntityFlux(org.springframework.web.service.invoker.HttpRequestValues requestValues, org.springframework.core.ParameterizedTypeReference<T> bodyType)
    • create

      public static WebClientAdapter create(WebClient webClient)
      Create a WebClientAdapter for the given WebClient instance.
      Parameters:
      webClient - the client to use
      Returns:
      the created adapter instance
      Since:
      6.1
    • forClient

      @Deprecated(since="6.1", forRemoval=true) public static WebClientAdapter forClient(WebClient webClient)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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 - the client to use
      Returns:
      the created adapter instance