use of io.apiman.gateway.engine.policy.Chain in project apiman by apiman.
the class ApiRequestExecutorImpl method createRequestChain.
/**
* Creates the chain used to apply policies in order to the api request.
*/
private Chain<ApiRequest> createRequestChain(IAsyncHandler<ApiRequest> requestHandler) {
RequestChain chain = new RequestChain(policyImpls, context);
chain.headHandler(requestHandler);
chain.policyFailureHandler(failure -> {
// It will likely not have been initialised, so create one.
if (responseChain == null) {
// Its response will not be used as we take the failure path only, so we just use an empty lambda.
responseChain = createResponseChain((ignored) -> {
});
}
responseChain.doFailure(failure);
});
chain.policyErrorHandler(policyErrorHandler);
return chain;
}
Aggregations