use of io.gravitee.gateway.policy.PolicyChainResult in project gravitee-gateway by gravitee-io.
the class RequestPolicyChainProcessor method execute.
public void execute(Request request, Response response, ExecutionContext executionContext) {
if (iterator.hasNext()) {
PolicyChainResolver policyChainResolver = iterator.next();
PolicyChain policyChain = policyChainResolver.resolve(StreamType.ON_REQUEST, request, response, executionContext);
lastPolicyChain = policyChain;
policyChain.setResultHandler(policyResult -> {
if (!policyResult.isFailure()) {
execute(request, response, executionContext);
} else {
resultHandler.handle(new PolicyChainResult(lastPolicyChain, policyResult));
}
});
policyChain.setStreamErrorHandler(result -> streamErrorHandler.handle(new PolicyChainResult(lastPolicyChain, result)));
policyChain.doNext(request, response);
} else {
resultHandler.handle(new PolicyChainResult(lastPolicyChain, null));
}
}
Aggregations