如何在Netty4中设置outbout HttpResponse的内容?

时间:2013-09-06 00:19:26

标签: java http netty

如何向DefaultHttpResponse添加内容?在Netty 3.x中有一个setContent() - 方法。我找不到有关如何在Netty 4中使用HTTP类的任何细节。似乎有一些En / Decoders可以与HTTP数据包一起使用,但我不知道如何。

1 个答案:

答案 0 :(得分:1)

您可以发送以下序列:

HttpResponse , n * HttpContent, LastHttpContent

只需使用

FullHttpResponse

DefaultHttpContentDefaultLastHttpContentDefaultFullHttpResponse将ByteBuf作为构造函数参数。