Class RequestAttributeAccess

java.lang.Object
com.linecorp.armeria.spring.client.RequestAttributeAccess

@UnstableApi public final class RequestAttributeAccess extends Object
Provides access to RequestAttributes specified when sending a request.

Example:


 interface GreetingService {
    @GetExchange("/hello")
    Mono<String> hello(@RequestAttribute("requestId") String requestId);
 }

 WebClient
   .builder("http://example.com")
   .decorator((delegate, ctx, req) -> {
      final String requestId = RequestAttributeAccess.get(ctx, "requestId");
      ctx.addAdditionalRequestHeader("X-Request-Id", requestId);
     return delegate.execute(ctx, req);
   })
   .build();

 GreetingService greetingService = ...
 // The request attribute will be set to the "X-Request-Id" header.
 greetingService.hello("123");