繁体   English   中英

可以在 Netty 中压缩请求吗?

[英]Possible to Compress Request in Netty?

是否可以在 Netty 中压缩请求? 我知道HttpContentCompressor存在,但它似乎只压缩响应。

对的,这是可能的。 您必须在管道中添加处理程序。

您的管道必须看起来像这样。

// Create a default pipeline implementation.
ChannelPipeline pipeline = pipeline();

// Decodes ChannelBuffer into HTTP Request message
pipeline.addLast("decoder", new HttpRequestDecoder());

// Encodes HTTTPRequest message to ChannelBuffer
pipeline.addLast("encoder", new HttpResponseEncoder());

// Compress
pipeline.addLast("deflater", new HttpContentCompressor(1));

// Handler to dispatch processing to our services
pipeline.addLast("handler", new YourHttpRequestHandler());

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM