Search in sources :

Example 1 with RequestCancelledEvent

use of com.netflix.zuul.netty.RequestCancelledEvent in project zuul by Netflix.

the class ZuulFilterChainHandler method userEventTriggered.

@Override
public final void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
    if (evt instanceof CompleteEvent) {
        final CompleteEvent completeEvent = (CompleteEvent) evt;
        fireEndpointFinish(completeEvent.getReason() != SESSION_COMPLETE);
    } else if (evt instanceof HttpRequestReadTimeoutEvent) {
        sendResponse(FAILURE_CLIENT_TIMEOUT, 408, ctx);
    } else if (evt instanceof IdleStateEvent) {
        sendResponse(FAILURE_LOCAL_IDLE_TIMEOUT, 504, ctx);
    } else if (evt instanceof RequestCancelledEvent) {
        if (zuulRequest != null) {
            StatusCategoryUtils.storeStatusCategoryIfNotAlreadyFailure(zuulRequest.getContext(), FAILURE_CLIENT_CANCELLED);
        }
        fireEndpointFinish(true);
        ctx.close();
    }
    super.userEventTriggered(ctx, evt);
}
Also used : IdleStateEvent(io.netty.handler.timeout.IdleStateEvent) HttpRequestReadTimeoutEvent(com.netflix.netty.common.HttpRequestReadTimeoutEvent) RequestCancelledEvent(com.netflix.zuul.netty.RequestCancelledEvent) CompleteEvent(com.netflix.netty.common.HttpLifecycleChannelHandler.CompleteEvent)

Aggregations

CompleteEvent (com.netflix.netty.common.HttpLifecycleChannelHandler.CompleteEvent)1 HttpRequestReadTimeoutEvent (com.netflix.netty.common.HttpRequestReadTimeoutEvent)1 RequestCancelledEvent (com.netflix.zuul.netty.RequestCancelledEvent)1 IdleStateEvent (io.netty.handler.timeout.IdleStateEvent)1