I managed to identify the problem:

the first request I sent was a GET request with null body. in the class
org.apache.camel.component.netty4.http.NettyHttpProducer - the method
getRequestBody(Exchange exchange) is creating the actual request object from
the exchange. in it - the method "toNettyRequest" in class
org.apache.camel.component.netty4.http.DefaultNettyHttpBinding checks if the
body is null, and if so - it is creating a DefaultHttpRequest, and not
DefaultHttpFullRequest

when the request reaches the encoder as a result of a writeAndFlush call -
the encoder does not clean its state because of this part of the code:

 if (msg instanceof LastHttpContent) {
    state = ST_INIT;
 }
the DefaultHttpRequest is not instanceof LastHttpContent, so the state
remains ST_CONTENT_NON_CHUNK and the next request will get an
IllegalStateException because the state is not ST_INIT

this bug did not exist in netty-http, it only happened when I moved to use
netty4-http

the workaround is simple - use an empty String ("") as body



--
View this message in context: 
http://camel.465427.n5.nabble.com/decoder-problem-in-netty4-tp5757370p5757400.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to