Search in sources :

Example 16 with HttpRequestDecoder

use of org.jboss.netty.handler.codec.http.HttpRequestDecoder in project load-balancer by RestComm.

the class ServerPipelineFactory method getPipeline.

public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("decoder", new HttpRequestDecoder());
    pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("handler", new HttpRequestHandler(listener));
    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 17 with HttpRequestDecoder

use of org.jboss.netty.handler.codec.http.HttpRequestDecoder in project load-balancer by RestComm.

the class TestHttpServerPipelineFactory method getPipeline.

public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = pipeline();
    if (!terminateTLSTraffic) {
        SslConfiguration sslConfig = new SslConfiguration();
        sslConfig.setKeyStorePath(TestHttpServerPipelineFactory.class.getClassLoader().getResource("keystore").getFile());
        sslConfig.setKeyStorePassword("123456");
        sslConfig.setTrustStorePath(TestHttpServerPipelineFactory.class.getClassLoader().getResource("keystore").getFile());
        sslConfig.setTrustStorePassword("123456");
        SslContextFactory factory = new SslContextFactory(sslConfig);
        SSLEngine sslEngine = factory.newSslEngine();
        sslEngine.setUseClientMode(false);
        pipeline.addLast("ssl", new SslHandler(sslEngine));
    }
    pipeline.addLast("decoder", new HttpRequestDecoder());
    // http://code.google.com/p/commscale/issues/detail?id=5 support for HttpChunks
    // https://telestax.atlassian.net/browse/LB-8 if commented accessing the RestComm Management console fails, so making the maxContentLength Configurable
    pipeline.addLast("aggregator", new HttpChunkAggregator(maxContentLength));
    pipeline.addLast("encoder", new HttpResponseEncoder());
    // Remove the following line if you don't want automatic content compression.
    // pipeline.addLast("deflater", new HttpContentCompressor());
    pipeline.addLast("handler", new HttpServerRequestHandler(requestCount, requests, chunkResponse, badSever));
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) SslContextFactory(com.cloudhopper.smpp.ssl.SslContextFactory) SslConfiguration(com.cloudhopper.smpp.ssl.SslConfiguration) SSLEngine(javax.net.ssl.SSLEngine) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) SslHandler(org.jboss.netty.handler.ssl.SslHandler)

Aggregations

HttpRequestDecoder (org.jboss.netty.handler.codec.http.HttpRequestDecoder)17 HttpResponseEncoder (org.jboss.netty.handler.codec.http.HttpResponseEncoder)17 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)15 HttpChunkAggregator (org.jboss.netty.handler.codec.http.HttpChunkAggregator)12 HttpContentCompressor (org.jboss.netty.handler.codec.http.HttpContentCompressor)7 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)4 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)4 SslHandler (org.jboss.netty.handler.ssl.SslHandler)4 InetSocketAddress (java.net.InetSocketAddress)3 NioServerSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory)3 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 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 ServiceBindException (co.cask.cdap.common.ServiceBindException)1