@Override
            public void handle(IAsyncResult<RateLimitResponse> result) {
                if (result.isError()) {
                    chain.throwError(result.getError());
                } else {
                    RateLimitResponse rtr = result.getResult();

                    Map<String, String> responseHeaders = responseHeaders(config, rtr,
                            defaultLimitHeader(), defaultRemainingHeader(), defaultResetHeader());

                    if (rtr.isAccepted()) {
                        context.setAttribute("rate-limit-response-headers", responseHeaders); //$NON-NLS-1$
                        chain.doApply(request);
                    } else {
                        IPolicyFailureFactoryComponent failureFactory = context.getComponent(IPolicyFailureFactoryComponent.class);
                        PolicyFailure failure = limitExceededFailure(failureFactory);
                        failure.getHeaders().putAll(responseHeaders);
                        chain.doFailure(failure);
                    }
                }
            }
@see io.apiman.gateway.engine.policies.AbstractMappedPolicy#doApply(io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/RateLimitingPolicy.java