Class RequestAttributeAccess
java.lang.Object
com.linecorp.armeria.spring.client.RequestAttributeAccess
Provides access to
RequestAttribute
s 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");
-
Method Summary
Modifier and TypeMethodDescriptionget
(ClientRequestContext ctx, String name) Returns theRequestAttribute
value associated with the name.
-
Method Details
-
get
Returns theRequestAttribute
value associated with the name.
-