Class ArmeriaHttpExchangeAdapter
java.lang.Object
org.springframework.web.service.invoker.AbstractReactorHttpExchangeAdapter
com.linecorp.armeria.spring.client.ArmeriaHttpExchangeAdapter
- All Implemented Interfaces:
HttpClientAdapter
,HttpExchangeAdapter
,ReactorHttpExchangeAdapter
@UnstableApi
public final class ArmeriaHttpExchangeAdapter
extends AbstractReactorHttpExchangeAdapter
A
ReactorHttpExchangeAdapter
implementation for the Armeria WebClient
.
This class is used to create
Spring HTTP Interface on top of Armeria WebClient
.
Example usage:
import com.linecorp.armeria.client.WebClient;
import org.springframework.web.service.invoker.HttpServiceProxyFactory;
WebClient webClient = ...;
ArmeriaHttpExchangeAdapter adapter =
ArmeriaHttpExchangeAdapter.of(webClient);
MyService service =
HttpServiceProxyFactory.builderFor(adapter)
.build()
.createClient(MyService.class);
-
Method Summary
Modifier and TypeMethodDescriptionReturns a newArmeriaHttpExchangeAdapterBuilder
with the specifiedWebClient
.exchangeForBodilessEntityMono
(HttpRequestValues requestValues) <T> Flux
<T> exchangeForBodyFlux
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) <T> Mono
<T> exchangeForBodyMono
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) <T> Mono
<ResponseEntity<Flux<T>>> exchangeForEntityFlux
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) <T> Mono
<ResponseEntity<T>> exchangeForEntityMono
(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) exchangeForHeadersMono
(HttpRequestValues requestValues) exchangeForMono
(HttpRequestValues requestValues) static ArmeriaHttpExchangeAdapter
Creates a new instance with the specifiedWebClient
.boolean
Returnstrue
because Armeria supportsRequestAttribute
.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
-
of
Creates a new instance with the specifiedWebClient
. -
builder
Returns a newArmeriaHttpExchangeAdapterBuilder
with the specifiedWebClient
. -
exchangeForMono
-
exchangeForHeadersMono
-
exchangeForBodyMono
public <T> Mono<T> exchangeForBodyMono(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) -
exchangeForBodyFlux
public <T> Flux<T> exchangeForBodyFlux(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) -
exchangeForBodilessEntityMono
-
exchangeForEntityMono
public <T> Mono<ResponseEntity<T>> exchangeForEntityMono(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) -
exchangeForEntityFlux
public <T> Mono<ResponseEntity<Flux<T>>> exchangeForEntityFlux(HttpRequestValues requestValues, ParameterizedTypeReference<T> bodyType) -
supportsRequestAttributes
public boolean supportsRequestAttributes()Returnstrue
because Armeria supportsRequestAttribute
. The attributes can be accessed in the Armeria decorators usingRequestAttributeAccess.get(ClientRequestContext, String)
.
-