It’s a bug of netty4-http, I just assigned the JIRA[1] you created to me.
[1] https://issues.apache.org/jira/browse/CAMEL-7894 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On October 8, 2014 at 4:07:51 PM, elyrank ([email protected]) wrote: > 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. >
