项目中使用netty作为web服务,postman请求体内容超出5mb请求netty时,返回413 Request Entity Too Large
查询了一下资料:https://netty.io/4.0/api/io/netty/handler/codec/http/HttpObjectAggregator.html
ChannelPipeline p = ...;
...
p.addLast("decoder", new HttpRequestDecoder());
p.addLast("encoder", new HttpResponseEncoder());
p.addLast("aggregator", new HttpObjectAggregator(1048576));
...
p.addLast("handler", new HttpRequestHandler());
修改HttpObjectAggregator的值 例如允许100MB那就是
p.addLast("aggregator", new HttpObjectAggregator(100 * 1024 * 1024));