本文介绍了带有Http2的Netty HttpObjectAggregator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Netty 4.1构建Http2服务器(该服务器仅需要支持Http2客户端).对于我最简单的请求处理,我想在执行任何业务逻辑之前先拥有完整的Http2请求(即 FullHttpRequest
).
I'm building an Http2 server with Netty 4.1 (and the server will only need to support Http2 clients). For my most simple request handling, I want to have the full Http2 request (i.e., FullHttpRequest
) before performing any business logic.
如何使用Http2做到这一点?Netty的 HttpObjectAggregator
似乎仅用于Http1.
How can I do this with Http2? Netty's HttpObjectAggregator
only seems intended for Http1.
推荐答案
为此,您可能需要在管道中使用 InboundHttp2ToHttpAdapter
.请检查:
For this you may need to use the InboundHttp2ToHttpAdapter
in your pipeline. Please check:
- https://github.com/netty/netty/blob/4.1/codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java
- https://github.com/netty/netty/blob/4.1/codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterBuilder.java
这篇关于带有Http2的Netty HttpObjectAggregator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!