nettylittle-proxy

Unable to import io.netty.handler.codec.http with LittleProxy


I'm currently running an implementation of Netty 4.1 with LittleProxy. Within the ClientToProxyConnection class I added in the line:

pipeline.addLast("aggregator", new HttpObjectAggregator(1048576));

I added this line to aggregate the chunked requests into one request. When I try and read the aggregated chunked requests as they come int, I get the error message:

java.lang.ClassCastException: io.netty.handler.coden.http.HttpObjectAggregator$AggregratedFullHttpResponse cannot be cast to io.netty.handler.coden.http.DefaultHttpResponse

I understand that I need to cast the response object to an AggregatedFullHttpResponse, but I'm unable to import the class I need, which sounds like it comes from the io.netty.handler.codec.http class, but I'm unable to import it. Any ideas what I'm missing?


Solution

  • Just cast to FullHttpResponse (this is the interface) and not the implementation itself.