Java Code Examples for com.netflix.loadbalancer.reactive.ExecutionContext#put()

The following examples show how to use com.netflix.loadbalancer.reactive.ExecutionContext#put() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BearerHeaderAdder.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartWithServer(ExecutionContext<HttpClientRequest<ByteBuf>> context, ExecutionInfo info) throws AbortExecutionException {
    KeycloakSecurityContext securityContext = KeycloakSecurityContextAssociation.get();
    if (securityContext != null) {
        HttpClientRequest<ByteBuf> request = context.getRequest();
        request.withHeader("Authorization", "Bearer " + securityContext.getTokenString());
        context.put(KeycloakSecurityContextAssociation.class.getName(), securityContext);
    } else {
        KeycloakSecurityContextAssociation.disassociate();
    }
}
 
Example 2
Source File: BearerHeaderAdder.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartWithServer(ExecutionContext<HttpClientRequest<ByteBuf>> context, ExecutionInfo info) throws AbortExecutionException {
    KeycloakSecurityContext securityContext = KeycloakSecurityContextAssociation.get();
    if (securityContext != null) {
        HttpClientRequest<ByteBuf> request = context.getRequest();
        request.withHeader("Authorization", "Bearer " + securityContext.getTokenString());
        context.put(KeycloakSecurityContextAssociation.class.getName(), securityContext);
    } else {
        KeycloakSecurityContextAssociation.disassociate();
    }
}
 
Example 3
Source File: TestExecutionListener.java    From ribbon with Apache License 2.0 4 votes vote down vote up
@Override
public void onExecutionStart(ExecutionContext<HttpClientRequest<I>> context) {
    context.put("MyObject", MY_OBJECT);
    checkContext(context);
    executionStartCounter.incrementAndGet();
}