Search in sources :

Example 1 with HttpContentDecompressor

use of org.jboss.netty.handler.codec.http.HttpContentDecompressor in project graylog2-server by Graylog2.

the class HttpTransport method getBaseChannelHandlers.

@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getBaseChannelHandlers(MessageInput input) {
    final LinkedHashMap<String, Callable<? extends ChannelHandler>> baseChannelHandlers = super.getBaseChannelHandlers(input);
    if (idleWriterTimeout > 0) {
        // Install read timeout handler to close idle connections after a timeout.
        // This avoids dangling HTTP connections when the HTTP client does not close the connection properly.
        // For details see: https://github.com/Graylog2/graylog2-server/issues/3223#issuecomment-270350500
        baseChannelHandlers.put("read-timeout-handler", () -> new ReadTimeoutHandler(timer, idleWriterTimeout, TimeUnit.SECONDS));
    }
    baseChannelHandlers.put("decoder", () -> new HttpRequestDecoder(DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_MAX_HEADER_SIZE, maxChunkSize));
    baseChannelHandlers.put("aggregator", () -> new HttpChunkAggregator(maxChunkSize));
    baseChannelHandlers.put("encoder", HttpResponseEncoder::new);
    baseChannelHandlers.put("decompressor", HttpContentDecompressor::new);
    return baseChannelHandlers;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpRequestDecoder(org.jboss.netty.handler.codec.http.HttpRequestDecoder) ReadTimeoutHandler(org.jboss.netty.handler.timeout.ReadTimeoutHandler) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) SimpleChannelHandler(org.jboss.netty.channel.SimpleChannelHandler) ChannelHandler(org.jboss.netty.channel.ChannelHandler) Callable(java.util.concurrent.Callable) HttpContentDecompressor(org.jboss.netty.handler.codec.http.HttpContentDecompressor)

Example 2 with HttpContentDecompressor

use of org.jboss.netty.handler.codec.http.HttpContentDecompressor in project camel by apache.

the class NettyHttpCompressTest method createRegistry.

// setup the decompress decoder here
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
    decoders.add(new HttpContentDecompressor());
    registry.bind("myDecoders", decoders);
    return registry;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) ArrayList(java.util.ArrayList) ChannelHandler(org.jboss.netty.channel.ChannelHandler) HttpContentDecompressor(org.jboss.netty.handler.codec.http.HttpContentDecompressor)

Example 3 with HttpContentDecompressor

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

the class GenericHttpClientPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    // Create a default pipeline implementation.
    ChannelPipeline pipeline = pipeline();
    if (_channelGroup != null)
        pipeline.addLast("auto group register ", new ConnectionChannelRegistrationHandler(_channelGroup));
    if (Logger.getRootLogger().isTraceEnabled()) {
        LOG.debug("Adding Netty tracing");
        pipeline.addLast("netty client traffic", new LoggingHandler("netty client traffic", InternalLogLevel.DEBUG, true));
    }
    if (null != _containerStatsCollector) {
        pipeline.addLast("inbound statistics collector", new InboundContainerStatisticsCollectingHandler(_containerStatsCollector));
    }
    ExtendedReadTimeoutHandler readTimeoutHandler = new ExtendedReadTimeoutHandler("client call ", _timeoutTimer, _readTimeoutMs, true);
    pipeline.addLast(READ_TIMEOUT_HANDLER_NAME, readTimeoutHandler);
    pipeline.addLast("codec", new HttpClientCodec());
    pipeline.addLast("http logger", new HttpRequestLoggingHandler());
    // Remove the following line if you don't want automatic content decompression.
    pipeline.addLast("inflater", new HttpContentDecompressor());
    // pipeline.addLast("handler", new GenericHttpResponseHandler(_responseProcessor, _keepAlive));
    pipeline.addLast("handler", _handler);
    // add a handler to deal with write timeouts
    pipeline.addLast("client request write timeout handler", new ExtendedWriteTimeoutHandler("netty client traffic", _timeoutTimer, _writeTimeoutMs, true));
    return pipeline;
}
Also used : ConnectionChannelRegistrationHandler(com.linkedin.databus2.core.container.netty.ConnectionChannelRegistrationHandler) LoggingHandler(org.jboss.netty.handler.logging.LoggingHandler) HttpRequestLoggingHandler(com.linkedin.databus2.core.container.HttpRequestLoggingHandler) ExtendedReadTimeoutHandler(com.linkedin.databus2.core.container.ExtendedReadTimeoutHandler) ExtendedWriteTimeoutHandler(com.linkedin.databus2.core.container.ExtendedWriteTimeoutHandler) HttpClientCodec(org.jboss.netty.handler.codec.http.HttpClientCodec) HttpRequestLoggingHandler(com.linkedin.databus2.core.container.HttpRequestLoggingHandler) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) InboundContainerStatisticsCollectingHandler(com.linkedin.databus2.core.container.netty.InboundContainerStatisticsCollectingHandler) HttpContentDecompressor(org.jboss.netty.handler.codec.http.HttpContentDecompressor)

Example 4 with HttpContentDecompressor

use of org.jboss.netty.handler.codec.http.HttpContentDecompressor in project bagheera by mozilla-metrics.

the class HttpServerPipelineFactory method getPipeline.

/* (non-Javadoc)
     * @see org.jboss.netty.channel.ChannelPipelineFactory#getPipeline()
     */
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("decoder", new BagheeraHttpRequestDecoder());
    pipeline.addLast("aggregator", new HttpChunkAggregator(maxContentLength));
    pipeline.addLast("contentLengthFilter", new ContentLengthFilter(maxContentLength));
    pipeline.addLast("rootResponse", new RootResponse());
    pipeline.addLast("accessFilter", new AccessFilter(validator, props));
    pipeline.addLast("encodingCorrector", new ContentEncodingCorrector());
    pipeline.addLast("inflater", new HttpContentDecompressor());
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("handler", new SubmissionHandler(validator, producer, this.channelGroup, this.metricsManager));
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) HttpContentDecompressor(org.jboss.netty.handler.codec.http.HttpContentDecompressor)

Example 5 with HttpContentDecompressor

use of org.jboss.netty.handler.codec.http.HttpContentDecompressor in project vcell by virtualcell.

the class HttpClientPipelineFactory method getPipeline.

public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    // pipeline.addLast("ssl", new SslHandler(engine));
    pipeline.addLast("codec", new HttpClientCodec());
    pipeline.addLast("inflater", new HttpContentDecompressor());
    // pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
    pipeline.addLast("handler", responseHandler);
    return pipeline;
}
Also used : HttpClientCodec(org.jboss.netty.handler.codec.http.HttpClientCodec) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) HttpContentDecompressor(org.jboss.netty.handler.codec.http.HttpContentDecompressor)

Aggregations

HttpContentDecompressor (org.jboss.netty.handler.codec.http.HttpContentDecompressor)6 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)4 HttpClientCodec (org.jboss.netty.handler.codec.http.HttpClientCodec)3 ChannelHandler (org.jboss.netty.channel.ChannelHandler)2 HttpChunkAggregator (org.jboss.netty.handler.codec.http.HttpChunkAggregator)2 HttpResponseEncoder (org.jboss.netty.handler.codec.http.HttpResponseEncoder)2 ExtendedReadTimeoutHandler (com.linkedin.databus2.core.container.ExtendedReadTimeoutHandler)1 ExtendedWriteTimeoutHandler (com.linkedin.databus2.core.container.ExtendedWriteTimeoutHandler)1 HttpRequestLoggingHandler (com.linkedin.databus2.core.container.HttpRequestLoggingHandler)1 ConnectionChannelRegistrationHandler (com.linkedin.databus2.core.container.netty.ConnectionChannelRegistrationHandler)1 InboundContainerStatisticsCollectingHandler (com.linkedin.databus2.core.container.netty.InboundContainerStatisticsCollectingHandler)1 ArrayList (java.util.ArrayList)1 Callable (java.util.concurrent.Callable)1 JndiRegistry (org.apache.camel.impl.JndiRegistry)1 DefaultChannelPipeline (org.jboss.netty.channel.DefaultChannelPipeline)1 SimpleChannelHandler (org.jboss.netty.channel.SimpleChannelHandler)1 HttpRequestDecoder (org.jboss.netty.handler.codec.http.HttpRequestDecoder)1 LoggingHandler (org.jboss.netty.handler.logging.LoggingHandler)1 ReadTimeoutHandler (org.jboss.netty.handler.timeout.ReadTimeoutHandler)1