我想用Netty ChannelHandler压缩和解压缩Gzip
,我尝试了一段时间,但总是有点困难。我的代码如下:
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
pipeline.addLast("inflater", new HttpContentDecompressor());
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("deflater", new HttpContentCompressor());
有什么问题吗?
我认为你的通道处理程序是在错误的顺序,这就是我如何有我的:
pipeline.addLast(DECODE, decoderProvider.get());
pipeline.addLast(ENCODE, encoderProvider.get());
pipeline.addLast(COMPRESS, compressorProvider.get());
pipeline.addLast(DECOMPRESS, decompressorProvider.get());
pipeline.addLast(AGGREGATE, aggregatorProvider.get());
pipeline.addLast(EXECUTE, new CustomRequestHandler();