|
@@ -307,21 +307,25 @@ public class Netty4HttpServerTransport extends AbstractHttpServerTransport {
|
|
protected void initChannel(Channel ch) throws Exception {
|
|
protected void initChannel(Channel ch) throws Exception {
|
|
Netty4HttpChannel nettyHttpChannel = new Netty4HttpChannel(ch);
|
|
Netty4HttpChannel nettyHttpChannel = new Netty4HttpChannel(ch);
|
|
ch.attr(HTTP_CHANNEL_KEY).set(nettyHttpChannel);
|
|
ch.attr(HTTP_CHANNEL_KEY).set(nettyHttpChannel);
|
|
- ch.pipeline().addLast("chunked_writer", new Netty4WriteThrottlingHandler(transport.getThreadPool().getThreadContext()));
|
|
|
|
- ch.pipeline().addLast("byte_buf_sizer", NettyByteBufSizer.INSTANCE);
|
|
|
|
- ch.pipeline().addLast("read_timeout", new ReadTimeoutHandler(transport.readTimeoutMillis, TimeUnit.MILLISECONDS));
|
|
|
|
|
|
+ ch.pipeline()
|
|
|
|
+ .addLast("chunked_writer", new Netty4WriteThrottlingHandler(transport.getThreadPool().getThreadContext()))
|
|
|
|
+ .addLast("byte_buf_sizer", NettyByteBufSizer.INSTANCE);
|
|
|
|
+ if (transport.readTimeoutMillis > 0) {
|
|
|
|
+ ch.pipeline().addLast("read_timeout", new ReadTimeoutHandler(transport.readTimeoutMillis, TimeUnit.MILLISECONDS));
|
|
|
|
+ }
|
|
final HttpRequestDecoder decoder = new HttpRequestDecoder(
|
|
final HttpRequestDecoder decoder = new HttpRequestDecoder(
|
|
handlingSettings.maxInitialLineLength(),
|
|
handlingSettings.maxInitialLineLength(),
|
|
handlingSettings.maxHeaderSize(),
|
|
handlingSettings.maxHeaderSize(),
|
|
handlingSettings.maxChunkSize()
|
|
handlingSettings.maxChunkSize()
|
|
);
|
|
);
|
|
decoder.setCumulator(ByteToMessageDecoder.COMPOSITE_CUMULATOR);
|
|
decoder.setCumulator(ByteToMessageDecoder.COMPOSITE_CUMULATOR);
|
|
- ch.pipeline().addLast("decoder", decoder);
|
|
|
|
- ch.pipeline().addLast("decoder_compress", new HttpContentDecompressor());
|
|
|
|
- ch.pipeline().addLast("encoder", new HttpResponseEncoder());
|
|
|
|
final HttpObjectAggregator aggregator = new HttpObjectAggregator(handlingSettings.maxContentLength());
|
|
final HttpObjectAggregator aggregator = new HttpObjectAggregator(handlingSettings.maxContentLength());
|
|
aggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents);
|
|
aggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents);
|
|
- ch.pipeline().addLast("aggregator", aggregator);
|
|
|
|
|
|
+ ch.pipeline()
|
|
|
|
+ .addLast("decoder", decoder)
|
|
|
|
+ .addLast("decoder_compress", new HttpContentDecompressor())
|
|
|
|
+ .addLast("encoder", new HttpResponseEncoder())
|
|
|
|
+ .addLast("aggregator", aggregator);
|
|
if (handlingSettings.compression()) {
|
|
if (handlingSettings.compression()) {
|
|
ch.pipeline().addLast("encoder_compress", new HttpContentCompressor(handlingSettings.compressionLevel()));
|
|
ch.pipeline().addLast("encoder_compress", new HttpContentCompressor(handlingSettings.compressionLevel()));
|
|
}
|
|
}
|