/** * Factory which ensures that this handler is added to the pipeline using the * correct name. * * @param timeout * @param unit */ public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter) { HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter); pipeline.addLast(HANDLER_NAME, handler); }
protected void addHttpRelatedHandlers(ChannelPipeline pipeline) { pipeline.addLast(new PassportStateHttpServerHandler()); if (httpRequestReadTimeout > -1) { HttpRequestReadTimeoutHandler.addLast(pipeline, httpRequestReadTimeout, TimeUnit.MILLISECONDS, httpRequestReadTimeoutCounter); } pipeline.addLast(new HttpServerLifecycleChannelHandler()); pipeline.addLast(new HttpBodySizeRecordingChannelHandler()); pipeline.addLast(httpMetricsHandler); pipeline.addLast(perEventLoopRequestsMetricsHandler); if (accessLogPublisher != null) { pipeline.addLast(new AccessLogChannelHandler(accessLogPublisher)); } pipeline.addLast(serverStatusHeaderHandler); //pipeline.addLast(requestThrottleHandler); pipeline.addLast(stripInboundProxyHeadersHandler); if (rateLimitingChannelHandler != null) { pipeline.addLast(rateLimitingChannelHandler); } //pipeline.addLast(requestRejectedChannelHandler); }
@Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { removeInternalHandler(ctx); super.handlerRemoved(ctx); }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { removeInternalHandler(ctx); super.channelInactive(ctx); }
/** * Factory which ensures that this handler is added to the pipeline using the * correct name. * * @param timeout * @param unit */ public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter) { HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter); pipeline.addLast(HANDLER_NAME, handler); }
protected void addHttpRelatedHandlers(ChannelPipeline pipeline) { pipeline.addLast(new PassportStateHttpServerHandler()); if (httpRequestReadTimeout > -1) { HttpRequestReadTimeoutHandler.addLast(pipeline, httpRequestReadTimeout, TimeUnit.MILLISECONDS, httpRequestReadTimeoutCounter); } pipeline.addLast(new HttpServerLifecycleChannelHandler()); pipeline.addLast(new HttpBodySizeRecordingChannelHandler()); pipeline.addLast(httpMetricsHandler); pipeline.addLast(perEventLoopRequestsMetricsHandler); if (accessLogPublisher != null) { pipeline.addLast(new AccessLogChannelHandler(accessLogPublisher)); } pipeline.addLast(serverStatusHeaderHandler); //pipeline.addLast(requestThrottleHandler); pipeline.addLast(stripInboundProxyHeadersHandler); if (rateLimitingChannelHandler != null) { pipeline.addLast(rateLimitingChannelHandler); } //pipeline.addLast(requestRejectedChannelHandler); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof LastHttpContent) { removeInternalHandler(ctx); } else if (msg instanceof HttpRequest) { // Start timeout handler. InternalReadTimeoutHandler handler = new InternalReadTimeoutHandler(timeout, unit); ctx.pipeline().addBefore(HANDLER_NAME, INTERNAL_HANDLER_NAME, handler); } super.channelRead(ctx, msg); }
/** * Factory which ensures that this handler is added to the pipeline using the * correct name. * * @param timeout * @param unit */ public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter) { HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter); pipeline.addLast(HANDLER_NAME, handler); }
protected void addHttpRelatedHandlers(ChannelPipeline pipeline) { pipeline.addLast(new PassportStateHttpServerHandler()); if (httpRequestReadTimeout > -1) { HttpRequestReadTimeoutHandler.addLast(pipeline, httpRequestReadTimeout, TimeUnit.MILLISECONDS, httpRequestReadTimeoutCounter); } pipeline.addLast(new HttpServerLifecycleChannelHandler()); pipeline.addLast(new HttpBodySizeRecordingChannelHandler()); pipeline.addLast(httpMetricsHandler); pipeline.addLast(perEventLoopRequestsMetricsHandler); if (accessLogPublisher != null) { pipeline.addLast(new AccessLogChannelHandler(accessLogPublisher)); } pipeline.addLast(serverStatusHeaderHandler); //pipeline.addLast(requestThrottleHandler); pipeline.addLast(stripInboundProxyHeadersHandler); if (rateLimitingChannelHandler != null) { pipeline.addLast(rateLimitingChannelHandler); } //pipeline.addLast(requestRejectedChannelHandler); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpRequestReadTimeoutEvent) { CurrentPassport.fromChannel(ctx.channel()).add(PassportState.IN_REQ_READ_TIMEOUT); removeInternalHandler(ctx); httpRequestReadTimeoutCounter.increment(); } super.userEventTriggered(ctx, evt); }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { removeInternalHandler(ctx); super.channelInactive(ctx); }
@Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { removeInternalHandler(ctx); super.handlerRemoved(ctx); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof LastHttpContent) { removeInternalHandler(ctx); } else if (msg instanceof HttpRequest) { // Start timeout handler. InternalReadTimeoutHandler handler = new InternalReadTimeoutHandler(timeout, unit); ctx.pipeline().addBefore(HANDLER_NAME, INTERNAL_HANDLER_NAME, handler); } super.channelRead(ctx, msg); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpRequestReadTimeoutEvent) { CurrentPassport.fromChannel(ctx.channel()).add(PassportState.IN_REQ_READ_TIMEOUT); removeInternalHandler(ctx); httpRequestReadTimeoutCounter.increment(); } super.userEventTriggered(ctx, evt); }
@Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { removeInternalHandler(ctx); super.handlerRemoved(ctx); }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { removeInternalHandler(ctx); super.channelInactive(ctx); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof LastHttpContent) { removeInternalHandler(ctx); } else if (msg instanceof HttpRequest) { // Start timeout handler. InternalReadTimeoutHandler handler = new InternalReadTimeoutHandler(timeout, unit); ctx.pipeline().addBefore(HANDLER_NAME, INTERNAL_HANDLER_NAME, handler); } super.channelRead(ctx, msg); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof HttpRequestReadTimeoutEvent) { CurrentPassport.fromChannel(ctx.channel()).add(PassportState.IN_REQ_READ_TIMEOUT); removeInternalHandler(ctx); httpRequestReadTimeoutCounter.increment(); } super.userEventTriggered(ctx, evt); }