org.jboss.netty.handler.codec.http.HttpChunkAggregator Java Examples
The following examples show how to use
org.jboss.netty.handler.codec.http.HttpChunkAggregator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpServer.java From feeyo-hlsserver with Apache License 2.0 | 6 votes |
public void startup(int port) { final int maxContentLength = 1024 * 1024 * 1024; bootstrap = new ServerBootstrap( new NioServerSocketChannelFactory(bossExecutor, workerExecutor)); bootstrap.setOption("connectTimeoutMillis", 10000); bootstrap.setOption("reuseAddress", true); // kernel optimization bootstrap.setOption("keepAlive", true); // for mobiles & our bootstrap.setOption("tcpNoDelay", true); // better latency over bootstrap.setPipelineFactory(new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline p = Channels.pipeline(); p.addLast("http-encoder", new HttpResponseEncoder()); p.addLast("http-decoder", new HttpRequestDecoder()); p.addLast("http-aggregator", new HttpChunkAggregator( maxContentLength )); p.addLast("server-handler", new HttpServerRequestHandler()); return p; } }); channel = bootstrap.bind(new InetSocketAddress(port)); }
Example #2
Source File: ShuffleHandler.java From hadoop with Apache License 2.0 | 6 votes |
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (sslFactory != null) { pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine())); } pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunking", new ChunkedWriteHandler()); pipeline.addLast("shuffle", SHUFFLE); return pipeline; // TODO factor security manager into pipeline // TODO factor out encode/decode to permit binary shuffle // TODO factor out decode of index to permit alt. models }
Example #3
Source File: TestDelegationTokenRemoteFetcher.java From hadoop with Apache License 2.0 | 6 votes |
private ServerBootstrap startHttpServer(int port, final Token<DelegationTokenIdentifier> token, final URI url) { ServerBootstrap bootstrap = new ServerBootstrap( new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); bootstrap.setPipelineFactory(new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { return Channels.pipeline(new HttpRequestDecoder(), new HttpChunkAggregator(65536), new HttpResponseEncoder(), new CredentialsLogicHandler(token, url.toString())); } }); bootstrap.bind(new InetSocketAddress("localhost", port)); return bootstrap; }
Example #4
Source File: ShuffleHandler.java From big-c with Apache License 2.0 | 6 votes |
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (sslFactory != null) { pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine())); } pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunking", new ChunkedWriteHandler()); pipeline.addLast("shuffle", SHUFFLE); return pipeline; // TODO factor security manager into pipeline // TODO factor out encode/decode to permit binary shuffle // TODO factor out decode of index to permit alt. models }
Example #5
Source File: TestDelegationTokenRemoteFetcher.java From big-c with Apache License 2.0 | 6 votes |
private ServerBootstrap startHttpServer(int port, final Token<DelegationTokenIdentifier> token, final URI url) { ServerBootstrap bootstrap = new ServerBootstrap( new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); bootstrap.setPipelineFactory(new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { return Channels.pipeline(new HttpRequestDecoder(), new HttpChunkAggregator(65536), new HttpResponseEncoder(), new CredentialsLogicHandler(token, url.toString())); } }); bootstrap.bind(new InetSocketAddress("localhost", port)); return bootstrap; }
Example #6
Source File: WebSocketServerPipelineFactory.java From usergrid with Apache License 2.0 | 6 votes |
@Override public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); if ( ssl ) { SSLEngine sslEngine = WebSocketSslContextFactory.getServerContext().createSSLEngine(); sslEngine.setUseClientMode( false ); pipeline.addLast( "ssl", new SslHandler( sslEngine ) ); } pipeline.addLast( "decoder", new HttpRequestDecoder() ); pipeline.addLast( "aggregator", new HttpChunkAggregator( 65536 ) ); pipeline.addLast( "encoder", new HttpResponseEncoder() ); pipeline.addLast( "execution", executionHandler ); pipeline.addLast( "handler", new WebSocketChannelHandler( emf, smf, management, securityManager, ssl ) ); return pipeline; }
Example #7
Source File: ShuffleHandler.java From tez with Apache License 2.0 | 6 votes |
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (sslFactory != null) { pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine())); } pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunking", new ChunkedWriteHandler()); pipeline.addLast("shuffle", SHUFFLE); pipeline.addLast("idle", idleStateHandler); pipeline.addLast(TIMEOUT_HANDLER, new TimeoutHandler()); return pipeline; // TODO factor security manager into pipeline // TODO factor out encode/decode to permit binary shuffle // TODO factor out decode of index to permit alt. models }
Example #8
Source File: NettyHttpServerTransport.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("openChannels", transport.serverOpenChannels); HttpRequestDecoder requestDecoder = new HttpRequestDecoder( (int) transport.maxInitialLineLength.bytes(), (int) transport.maxHeaderSize.bytes(), (int) transport.maxChunkSize.bytes() ); if (transport.maxCumulationBufferCapacity != null) { if (transport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) { requestDecoder.setMaxCumulationBufferCapacity(Integer.MAX_VALUE); } else { requestDecoder.setMaxCumulationBufferCapacity((int) transport.maxCumulationBufferCapacity.bytes()); } } if (transport.maxCompositeBufferComponents != -1) { requestDecoder.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents); } pipeline.addLast("decoder", requestDecoder); pipeline.addLast("decoder_compress", new ESHttpContentDecompressor(transport.compression)); HttpChunkAggregator httpChunkAggregator = new HttpChunkAggregator((int) transport.maxContentLength.bytes()); if (transport.maxCompositeBufferComponents != -1) { httpChunkAggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents); } pipeline.addLast("aggregator", httpChunkAggregator); pipeline.addLast("encoder", new ESHttpResponseEncoder()); if (transport.compression) { pipeline.addLast("encoder_compress", new HttpContentCompressor(transport.compressionLevel)); } if (transport.settings().getAsBoolean(SETTING_CORS_ENABLED, false)) { pipeline.addLast("cors", new CorsHandler(transport.getCorsConfig())); } if (transport.pipelining) { pipeline.addLast("pipelining", new HttpPipeliningHandler(transport.pipeliningMaxEvents)); } pipeline.addLast("handler", requestHandler); return pipeline; }
Example #9
Source File: TaskTracker.java From RDFS with Apache License 2.0 | 5 votes |
@Override public ChannelPipeline getPipeline() throws Exception { return Channels.pipeline( new HttpRequestDecoder(), new HttpChunkAggregator(1 << 16), new HttpResponseEncoder(), new ChunkedWriteHandler(), shuffleHandler); }
Example #10
Source File: HttpInvoker.java From elasticsearch-helper with Apache License 2.0 | 5 votes |
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("codec", new HttpClientCodec()); pipeline.addLast("aggregator", new HttpChunkAggregator(settings.getAsInt("http.client.maxchunksize", 10 * 1024 * 1024))); pipeline.addLast("inflater", new HttpContentDecompressor()); pipeline.addLast("handler", new HttpInvoker.HttpResponseHandler()); return pipeline; }
Example #11
Source File: HttpElasticsearchClient.java From elasticsearch-helper with Apache License 2.0 | 5 votes |
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("codec", new HttpClientCodec()); pipeline.addLast("aggregator", new HttpChunkAggregator(settings.getAsInt("http.client.maxchunksize", 10 * 1024 * 1024))); pipeline.addLast("inflater", new HttpContentDecompressor()); pipeline.addLast("handler", new HttpResponseHandler()); return pipeline; }
Example #12
Source File: ShuffleHandler.java From tez with Apache License 2.0 | 5 votes |
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunking", new ChunkedWriteHandler()); pipeline.addLast("shuffle", SHUFFLE); return pipeline; // TODO factor security manager into pipeline // TODO factor out encode/decode to permit binary shuffle // TODO factor out decode of index to permit alt. models }