Search in sources :

Example 16 with HttpResponseEncoder

use of org.jboss.netty.handler.codec.http.HttpResponseEncoder in project voldemort by voldemort.

the class CoordinatorPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("connectionStats", connectionStatsHandler);
    pipeline.addLast("decoder", new HttpRequestDecoder(this.coordinatorConfig.getHttpMessageDecoderMaxInitialLength(), this.coordinatorConfig.getHttpMessageDecoderMaxHeaderSize(), this.coordinatorConfig.getHttpMessageDecoderMaxChunkSize()));
    pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("deflater", new HttpContentCompressor());
    pipeline.addLast("handler", new RestCoordinatorRequestHandler(fatClientMap));
    pipeline.addLast("coordinatorExecutionHandler", coordinatorExecutionHandler);
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) HttpContentCompressor(org.jboss.netty.handler.codec.http.HttpContentCompressor) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 17 with HttpResponseEncoder

use of org.jboss.netty.handler.codec.http.HttpResponseEncoder in project voldemort by voldemort.

the class CoordinatorAdminPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("decoder", new HttpRequestDecoder());
    pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_AGGREGATE_SIZE));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("deflater", new HttpContentCompressor());
    pipeline.addLast("handler", new CoordinatorAdminRequestHandler(storeClientConfigs));
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) HttpContentCompressor(org.jboss.netty.handler.codec.http.HttpContentCompressor) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 18 with HttpResponseEncoder

use of org.jboss.netty.handler.codec.http.HttpResponseEncoder in project feeyo-hlsserver by variflight.

the class HttpServer method startup.

public void startup(int port) {
    final int maxContentLength = 1024 * 1024 * 1024;
    bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(bossExecutor, workerExecutor));
    bootstrap.setOption("connectTimeoutMillis", 10000);
    // kernel optimization
    bootstrap.setOption("reuseAddress", true);
    // for mobiles & our
    bootstrap.setOption("keepAlive", true);
    // better latency over
    bootstrap.setOption("tcpNoDelay", true);
    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));
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) NioServerSocketChannelFactory(org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) InetSocketAddress(java.net.InetSocketAddress) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 19 with HttpResponseEncoder

use of org.jboss.netty.handler.codec.http.HttpResponseEncoder in project socket.io-netty by ibdknox.

the class WebSocketServerPipelineFactory method getPipeline.

public ChannelPipeline getPipeline() throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("decoder", new HttpRequestDecoder());
    pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("handler", socketHandler);
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 20 with HttpResponseEncoder

use of org.jboss.netty.handler.codec.http.HttpResponseEncoder in project databus by linkedin.

the class DummyHttpRequestHandler method setupServer.

private void setupServer(DummyHttpRequestHandler requestHandler) {
    _serverBootstrap = new ServerBootstrap(new DefaultLocalServerChannelFactory());
    ChannelPipeline serverPipeline = pipeline();
    serverPipeline.addLast("server logger 1", new LoggingHandler("server logger 1", InternalLogLevel.DEBUG, true));
    serverPipeline.addLast("decoder", new HttpRequestDecoder());
    serverPipeline.addLast("encoder", new HttpResponseEncoder());
    serverPipeline.addLast("server loggger 5", new LoggingHandler("server logger 5", InternalLogLevel.DEBUG, true));
    serverPipeline.addLast("handler", requestHandler);
    _serverBootstrap.setPipeline(serverPipeline);
    _serverAddress = new LocalAddress(1);
    _serverChannel = _serverBootstrap.bind(_serverAddress);
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) DefaultLocalServerChannelFactory(org.jboss.netty.channel.local.DefaultLocalServerChannelFactory) LoggingHandler(org.jboss.netty.handler.logging.LoggingHandler) LocalAddress(org.jboss.netty.channel.local.LocalAddress) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Aggregations

HttpResponseEncoder (org.jboss.netty.handler.codec.http.HttpResponseEncoder)20 HttpRequestDecoder (org.jboss.netty.handler.codec.http.HttpRequestDecoder)19 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)18 HttpChunkAggregator (org.jboss.netty.handler.codec.http.HttpChunkAggregator)15 HttpContentCompressor (org.jboss.netty.handler.codec.http.HttpContentCompressor)7 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)5 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)5 InetSocketAddress (java.net.InetSocketAddress)4 NioServerSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory)4 SslHandler (org.jboss.netty.handler.ssl.SslHandler)4 SslConfiguration (com.cloudhopper.smpp.ssl.SslConfiguration)2 SslContextFactory (com.cloudhopper.smpp.ssl.SslContextFactory)2 JmxReporter (com.codahale.metrics.JmxReporter)2 Channel (org.jboss.netty.channel.Channel)2 HttpContentDecompressor (org.jboss.netty.handler.codec.http.HttpContentDecompressor)2 Logger (ch.qos.logback.classic.Logger)1 LoggerContext (ch.qos.logback.classic.LoggerContext)1 PatternLayoutEncoder (ch.qos.logback.classic.encoder.PatternLayoutEncoder)1 ILoggingEvent (ch.qos.logback.classic.spi.ILoggingEvent)1 ConsoleAppender (ch.qos.logback.core.ConsoleAppender)1