Hi Stephane,

I just took a quick stab and it works with the following route, note the
endpoint  is the url with netty4 prefixed.

    @Override
    protected RoutesBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {

from("direct:ecb").streamCaching().wireTap("log:TRACE?showAll=true")
                        .to("netty4-
http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";);
            }
        };
    }

    @Test
    public void testNetty() {
        String body = template.requestBody("direct:ecb", "", String.class);
        assertNotNull(body);
        assertTrue(body.contains("European Central Bank"));
    }


Cheers

On Mon, Feb 6, 2017 at 2:25 AM, Willem Jiang <willem.ji...@gmail.com> wrote:

> Hi,
>
> I went through the whole thread, but didn't find out how the
> camel-netty4-http endpoint is used (from the camel route).
> I guess that something is still missing.
>
>
>
> Willem Jiang
>
> Blog: http://willemjiang.blogspot.com (English)
>           http://jnn.iteye.com  (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Mon, Feb 6, 2017 at 3:07 AM, scoutant <scout...@freesbee.fr> wrote:
>
> > Good evening Claus,
> >
> > Thank you for your swift reply.
> >
> > In fact, I have omitted to say that I already turned on the stream
> caching
> > (my fault, I work hard 7/7, please forgine me), by doing this:
> >
> >                 getContext().setTracing(true);
> >                 getContext().setStreamCaching(true);
> >                 getContext().getStreamCachingStrategy().
> > setSpoolDirectory("./");
> >                 getContext().getStreamCachingStrategy().
> setSpoolThreshold(64
> > * 1024);
> >                 getContext().getStreamCachingStrategy().
> setBufferSize(130
> > * 1024);
> >
> > Following what I read from Netty4-HTTP component documentation.
> > Before setting this during my test sessions, I had same result (body
> null),
> > but no response header as well.
> >
> > And to be honest, I have also omitted that I set netty configuration like
> > this:
> >
> >                 NettyHttpConfiguration configuration =
> > super.getConfiguration();
> >
> >                 //configuration.setAllowDefaultCodec(true); Not
> supported
> > by Netty
> >                 configuration.setAllowSerializedHeaders(false);
> >                 configuration.setConnectTimeout(CONNECT_
> > TIMEOUT_IN_SECONDS);
> >                 configuration.setAutoAppendDelimiter(false);
> >                 configuration.setBroadcast(false);
> >                 configuration.setClientMode(true);
> >                 configuration.setDisconnectOnNoReply(true);
> >                 configuration.setKeepAlive(false);
> >                 configuration.setLazyChannelCreation(false);
> >                 configuration.setReconnect(false);
> >                 configuration.setSync(true);
> >                 configuration.setTcpNoDelay(true);
> >                 configuration.setSend503whenSuspended(true);
> >                 configuration.setThrowExceptionOnFailure(true);
> >                 configuration.setTransferException(false);
> >
> >
> > And I have created a JNDI Registry in camel context (I don't think it has
> > an
> > impact, but).
> >
> > This time, I promise there is no more hidden information!
> >
> > By the way, I don't know if it can have an incidence, but the ECB server
> > returns a xml file (application/xml), but the content-type indicated is
> > "text".
> >
> > Thanks again for your reply.
> > Kind regards,
> > Stéphane Coutant
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> > com/Netty-Http4-client-Null-body-whereas-content-length-0-
> > tp5793490p5793494.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>

Reply via email to