@Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); if (sslCtx != null) { p.addLast(sslCtx.newHandler(ch.alloc())); } if (enableGzip) { p.addLast(new HttpContentCompressor()); } p.addLast(new HttpServerCodec(36192 * 2, 36192 * 8, 36192 * 16, false)); p.addLast(new HttpServerExpectContinueHandler()); p.addLast(new HttpObjectAggregator(Integer.MAX_VALUE)); p.addLast(new ChunkedWriteHandler()); if (enableCors) { CorsConfig corsConfig = CorsConfigBuilder.forAnyOrigin().allowNullOrigin().allowCredentials().build(); p.addLast(new CorsHandler(corsConfig)); } if (null != blade.webSocketPath()) { p.addLast(new WebSocketServerProtocolHandler(blade.webSocketPath(), null, true)); p.addLast(new WebSockerHandler(blade)); } service.scheduleWithFixedDelay(() -> date = new AsciiString(DateKit.gmtDate(LocalDateTime.now())), 1000, 1000, TimeUnit.MILLISECONDS); p.addLast(new HttpServerHandler()); }
@Override protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast( new HttpServerCodec(), new HttpServerExpectContinueHandler(), new HttpObjectAggregator(Integer.MAX_VALUE), new ChunkedWriteHandler(), new HttpRequestHandler() ); }
@Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline(); if (sslCtx != null) { p.addLast(sslCtx.newHandler(ch.alloc())); } p.addLast(new HttpServerCodec()); p.addLast(new HttpServerExpectContinueHandler()); p.addLast(new HttpHelloWorldServerHandler()); }
@Override public void handlePipeline(ChannelPipeline pipeline) { pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpServerExpectContinueHandler()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new ChunkedWriteHandler()); pipeline.addLast(new HttpContentCompressor()); pipeline.addLast(new HttpRequestHandler(sslContextManager)); }
private void setHttpInterceptor(ChannelHandlerContext ctx, boolean ssl) { ctx.pipeline().addLast(new HttpServerCodec()); ctx.pipeline().addLast("", new HttpServerExpectContinueHandler()); ctx.pipeline().addLast("replay-handler", new ReplayHandler(outboundChannel)); outboundChannel.pipeline().addLast(new HttpClientCodec()); HttpInterceptor interceptor = new HttpInterceptor(ssl, address, messageListener, ctx.pipeline()); outboundChannel.pipeline().addLast("http-interceptor", interceptor); outboundChannel.pipeline().addLast("replay-handler", new ReplayHandler(ctx.channel())); }
@Override public void initChannel(final SocketChannel socketChannel) throws Exception { ChannelPipeline pl = socketChannel.pipeline(); // TODO ssl handler pl.addLast("codec", new HttpServerCodec()); // enable gzip if (razor.getEnv().getBool(ENV_KEY_GZIP, DEFAULT_GZIP_ENABLE)) { pl.addLast("gzip", new HttpContentCompressor()); } pl.addLast("continue", new HttpServerExpectContinueHandler()); pl.addLast("aggregator", new HttpObjectAggregator(512*1024)); pl.addLast("chunk", new ChunkedWriteHandler()); pl.addLast("request", new HttpServerHandler(razor)); }
@Override public void handlePipeline(ChannelPipeline pipeline) { pipeline.addLast(new HttpServerCodec()); pipeline.addLast("", new HttpServerExpectContinueHandler()); pipeline.addLast(new HttpProxyHandler(messageListener, proxyHandlerSupplier)); }