0

我正在使用一个可配置的代理(小代理)来监听从客户端(即 chrome 浏览器)生成的请求。我需要发布请求的正文。

在管道中,这是我添加的。我以为我会得到一个 FullHttpRequest,但得到

pipeline.addLast("decoder", new HttpRequestDecoder(8192*4, 8192 * 8,8192 * 8));
pipeline.addLast("inflater", new HttpContentDecompressor());
pipeline.addLast("aggregator", new HttpObjectAggregator(1048576));
pipeline.addLast("encoder", new HttpResponseEncoder());

对于 Post 请求,我得到这个数据类型 HttpObjectAggregator#AggregatedFullHttpRequest。我尝试调试。但无法理解compositebytebuff的概念。

让我知道如何实现这一目标。

4

1 回答 1

0

发现问题。我认为抛出的错误是由于一些 bytebuf 问题。这是因为,当我收听请求时,我得到了原始请求并发送了它。但问题是,当 channelRead 被触发时,内容(bytebuf)将被释放。因此,我试图访问已经发布的内容。因此,当我收听请求并提供给收听者时,我制作了内容的副本(因此当 channelRead 被触发时它不会被释放)。所以他将能够访问内容。

于 2016-06-23T11:32:56.277 回答