List of usage examples for io.netty.handler.codec.http HttpContentCompressor HttpContentCompressor
public HttpContentCompressor()
From source file:org.waarp.openr66.protocol.http.adminssl.HttpSslInitializer.java
License:Open Source License
@Override protected void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); // Add SSL handler first to encrypt and decrypt everything. SslHandler sslhandler = Configuration.getWaarpSslContextFactory().initInitializer(true, false); pipeline.addLast("ssl", sslhandler); pipeline.addLast("decoder", new HttpServerCodec()); pipeline.addLast("aggregator", new HttpObjectAggregator(1048576)); pipeline.addLast("streamer", new ChunkedWriteHandler()); if (useHttpCompression) { pipeline.addLast("deflater", new HttpContentCompressor()); }//from w w w. j a v a 2 s . co m pipeline.addLast("handler", new HttpSslHandler()); }
From source file:org.waarp.openr66.protocol.http.HttpInitializer.java
License:Open Source License
@Override protected void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("decoder", new HttpServerCodec()); pipeline.addLast("aggregator", new HttpObjectAggregator(1048576)); pipeline.addLast("streamer", new ChunkedWriteHandler()); if (useHttpCompression) { pipeline.addLast("deflater", new HttpContentCompressor()); }//from ww w .j a v a2 s. com pipeline.addLast("handler", new HttpFormattedHandler()); }
From source file:org.waarp.openr66.protocol.http.rest.HttpRestR66Initializer.java
License:Open Source License
protected void initChannel(SocketChannel ch) throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = ch.pipeline(); // Enable HTTPS if necessary. if (waarpSslContextFactory != null) { SslHandler handler = waarpSslContextFactory.initInitializer(true, false); pipeline.addLast("ssl", handler); }/*from w ww . j a va 2 s . c o m*/ pipeline.addLast("codec", new HttpServerCodec()); /* GlobalTrafficShapingHandler handler = Configuration.configuration.getGlobalTrafficShapingHandler(); if (handler != null) { pipeline.addLast(NetworkServerInitializer.LIMIT, handler); } ChannelTrafficShapingHandler trafficChannel = null; try { trafficChannel = Configuration.configuration.newChannelTrafficShapingHandler(); if (trafficChannel != null) { pipeline.addLast(NetworkServerInitializer.LIMITCHANNEL, trafficChannel); } } catch (OpenR66ProtocolNoDataException e) { } */ if (useHttpCompression) { pipeline.addLast("deflater", new HttpContentCompressor()); } pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); HttpRestR66Handler r66handler = new HttpRestR66Handler(restConfiguration); pipeline.addLast("handler", r66handler); }
From source file:org.waarp.openr66.proxy.protocol.http.adminssl.HttpSslInitializer.java
License:Open Source License
protected void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); // Add SSL handler first to encrypt and decrypt everything. SslHandler sslhandler = Configuration.getWaarpSslContextFactory().initInitializer(true, false); pipeline.addLast("ssl", sslhandler); pipeline.addLast("decoder", new HttpServerCodec()); pipeline.addLast("aggregator", new HttpObjectAggregator(1048576)); pipeline.addLast("streamer", new ChunkedWriteHandler()); if (useHttpCompression) { pipeline.addLast("deflater", new HttpContentCompressor()); }/*from ww w . j av a 2 s. c o m*/ pipeline.addLast("handler", new HttpSslHandler()); }
From source file:org.waarp.openr66.proxy.protocol.http.HttpInitializer.java
License:Open Source License
protected void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("decoder", new HttpServerCodec()); pipeline.addLast("aggregator", new HttpObjectAggregator(1048576)); pipeline.addLast("streamer", new ChunkedWriteHandler()); if (useHttpCompression) { pipeline.addLast("deflater", new HttpContentCompressor()); }// www . ja v a 2 s . c o m pipeline.addLast("handler", new HttpFormattedHandler()); }
From source file:org.wingsource.wingweb.http.cxf.jaxrs.NettyHttpServletPipelineFactory.java
License:Apache License
protected ChannelPipeline getDefaulHttpChannelPipeline(Channel channel) throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = channel.pipeline(); SslHandler sslHandler = configureServerSSLOnDemand(); if (sslHandler != null) { LOG.log(Level.FINE,//w w w .j a v a2 s . com "Server SSL handler configured and added as an interceptor against the ChannelPipeline: {}", sslHandler); pipeline.addLast("ssl", sslHandler); } pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpObjectAggregator(maxChunkContentSize)); pipeline.addLast("encoder", new HttpResponseEncoder()); // Remove the following line if you don't want automatic content // compression. pipeline.addLast("deflater", new HttpContentCompressor()); // Set up the idle handler pipeline.addLast("idle", new IdleStateHandler(nettyHttpServerEngine.getReadIdleTime(), nettyHttpServerEngine.getWriteIdleTime(), 0)); return pipeline; }
From source file:org.wso2.carbon.mss.internal.MSSNettyServerInitializer.java
License:Open Source License
public void initChannel(SocketChannel channel) { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("compressor", new HttpContentCompressor()); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("streamer", new ChunkedWriteHandler()); pipeline.addLast(eventExecutorGroup, "router", new RequestRouter(microservicesRegistry.getHttpResourceHandler(), 0)); pipeline.addLast(eventExecutorGroup, "dispatcher", new HttpDispatcher()); }
From source file:org.wso2.carbon.mss.internal.router.ServerInitializer.java
License:Open Source License
@Override protected void initChannel(SocketChannel channel) throws Exception { ChannelPipeline pipeline = channel.pipeline(); if (sslHandlerFactory != null) { pipeline.addLast("ssl", sslHandlerFactory.create()); }//from w w w . j a v a 2 s . c o m // pipeline.addLast("tracker", connectionTracker); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("decoder", new HttpRequestDecoder()); // pipeline.addLast("aggregator", new HttpObjectAggregator(httpChunkLimit)); pipeline.addLast("aggregator", new HttpObjectAggregator(Integer.MAX_VALUE)); //TODO: put a proper value //TODO: add this only if chunking is enabled (BodyConsumer implemented?) pipeline.addLast("chunkWriter", new ChunkedWriteHandler()); pipeline.addLast("compressor", new HttpContentCompressor()); pipeline.addLast(eventExecutor, "router", new RequestRouter(resourceHandler, httpChunkLimit)); if (pipelineModifier != null) { pipelineModifier.apply(pipeline); } }
From source file:org.wso2.carbon.transport.http.netty.listener.CarbonHTTPServerInitializer.java
License:Open Source License
@Override public void initChannel(SocketChannel ch) throws Exception { if (log.isDebugEnabled()) { log.debug("Initializing source channel pipeline"); }//from ww w .j av a 2 s .com int port = ch.localAddress().getPort(); String id = String.valueOf(port); ListenerConfiguration listenerConfiguration = listenerConfigurationMap.get(id); if (sslConfigMap.get(id) != null) { SslHandler sslHandler = new SSLHandlerFactory(sslConfigMap.get(id)).create(); ch.pipeline().addLast("ssl", sslHandler); } else if (sslConfig != null) { SslHandler sslHandler = new SSLHandlerFactory(sslConfig).create(); ch.pipeline().addLast("ssl", sslHandler); } ChannelPipeline p = ch.pipeline(); p.addLast("encoder", new HttpResponseEncoder()); if (RequestSizeValidationConfiguration.getInstance().isHeaderSizeValidation()) { p.addLast("decoder", new CustomHttpRequestDecoder()); } else { p.addLast("decoder", new HttpRequestDecoder()); } if (RequestSizeValidationConfiguration.getInstance().isRequestSizeValidation()) { p.addLast("custom-aggregator", new CustomHttpObjectAggregator()); } p.addLast("compressor", new HttpContentCompressor()); p.addLast("chunkWriter", new ChunkedWriteHandler()); try { p.addLast("handler", new SourceHandler(connectionManager, listenerConfiguration)); } catch (Exception e) { log.error("Cannot Create SourceHandler ", e); } }
From source file:org.wso2.carbon.transport.http.netty.listener.CarbonNettyServerInitializer.java
License:Open Source License
@Override public void initChannel(Object ch) { if (log.isDebugEnabled()) { log.info("Initializing source channel pipeline"); }/*from ww w. j a va2 s .c o m*/ ChannelPipeline p = ((SocketChannel) ch).pipeline(); p.addLast("decoder", new HttpRequestDecoder()); p.addLast("encoder", new HttpResponseEncoder()); p.addLast("compressor", new HttpContentCompressor()); p.addLast("chunkWriter", new ChunkedWriteHandler()); try { if (Boolean.parseBoolean(listenerConfiguration.getEnableDisruptor())) { p.addLast("handler", new SourceHandler(connectionManager)); } else { p.addLast("handler", new WorkerPoolDispatchingSourceHandler(connectionManager, listenerConfiguration)); } } catch (Exception e) { log.error("Cannot Create SourceHandler ", e); } }