Thanks for this analysis, I updated the code accordingly and deployed a 3.1.11-SNAPSHOT version of cxf-rt-transports-http-netty-server, can you try it please ?

It appears most of CXF users have been working with Jetty when an embedded HTTP container is needed, but it is quite likely we will see more Netty related queries going forward, so please stress this transport

Cheers, Sergey
On 10/03/17 13:02, martijn.list wrote:
On 03/10/2017 01:18 PM, Sergey Beryozkin wrote:
Hi

It looks like it is a Netty specific issue, I just checked there was a
fix provided only 9 days ago,

https://github.com/netty/netty/pull/6474.

We will likely need to update to newer Netty 4.1.x later on.

It is hard to know though if that PR will address this specific issue
but hopefully yes,

That what I was thinking as well. However the bug report that is linked
to indicates that the fix is only for cases where a HttpObjectAggregator
is not used.

https://github.com/netty/netty/issues/5180

However NettyHttpServletPipelineFactory seems to use a HttpObjectAggregator

https://github.com/apache/cxf/blob/master/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/NettyHttpServletPipelineFactory.java

According to following (incorrect) bug report, a similar problem was
reported and the fix was to place HttpResponseEncoder before
HttpObjectAggregator in the pipeline

"The HttpResponseEncoder must be before the HttpObjectAggregator . This
is also explained in the HttpObjectAggregator javadocs."

https://github.com/netty/netty/issues/2606

Looking at the source for NettyHttpServletPipelineFactory, is looks like
HttpResponseEncoder is placed after HttpObjectAggregator.

Could this be the reason why "Expect: 100-continue" support fails?

Kind regards,

Martijn Brinkers


Cheers, Sergey
On 10/03/17 09:05, martijn.list wrote:
Hi,

I'm using CXF to create a jax-rs web service. Accessing the service from
a simple HTML form works correctly.

However when using curl to send a binary attachment, I get the following
server side exception

10 Mar 2017 09:55:56 | ERROR Unexpected exception from downstream in
Netty servlet handler, due to: {0}.
(org.apache.cxf.transport.http.netty.server.NettyHttpServletHandler)
[defaultEventExecutorGroup-7-1]
io.netty.handler.codec.UnsupportedMessageTypeException:
io.netty.handler.codec.http.DefaultFullHttpResponse (expected:
io.netty.buffer.ByteBuf)
    at io.netty.handler.ssl.SslHandler.write(SslHandler.java:474)
    at
io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:619)

    at
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:676)

    at
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:667)

    at
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:693)

    at
io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:166)

    at
io.netty.handler.codec.http.HttpObjectAggregator.decode(HttpObjectAggregator.java:57)

    at
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)

    at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)

    at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)

    at
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:277)

    at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:264)

    at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)

    at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)

    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1070)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:904)

curl by default seems to issue a "Expect: 100-continue". The web service
call works if I disable "Expect: 100-continue" support. In this case
curl will post the request immediately. I have confirmed using some
other client application that if the client uses "Expect: 100-continue",
the web service does not function.

It seems that CXF jax-rs with netty as the HTTP(s) transport, does not
support "Expect: 100-continue" out of the box. Is there something I'm
missing in my configuration? Is it possible to enable "Expect:
100-continue" support?

Kind regards,

Martijn Brinkers

PS I'm using CXF 3.0.12







--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to