Hi Jens,

It's my bad, I should not try to covert the message into StreamCache.
As it will consume the input stream, I will commit a quick fix shortly.

Willem

_Jens wrote:
Hi Willem,

unfortunately I was not able to get this working. I saw the unit test that
you checked in for this. The test runs without an error. However, it does
not verify this completely. Although it is now possible to get the stream,
the stream has been read. I changed the route builder used in the test to
this:

from("jetty:http://localhost:9083/noStreamCache?disableStreamCache=true";).noStreamCaching().process(new
Processor() {

                    public void process(Exchange exchange) throws Exception
{
                        InputStream is =
(InputStream)exchange.getIn().getBody();
                        assertTrue(is.read() != -1);
                        System.out.println(is.getClass());
                        assertTrue("It should be a raw inputstream", is
instanceof org.eclipse.jetty.server.HttpInput);
                        exchange.getOut().setBody("OK");
                    }
});

And then the check for "is.read() != -1" fails. The reason for this is
within DefaultHttpBinding.readRequest:

        // reset the stream cache
        StreamCache cache = message.getBody(StreamCache.class);

This reads the actual input stream into a CachedInputStream, no matter what
settings are disabled.

Jens



willem.jiang wrote:
Just FYI,

I introduced a disableStreamCache option into HttpComponent[1], by setting this option to be true, you will get the pure input stream that Jetty provides.

[1] https://issues.apache.org/activemq/browse/CAMEL-2738


Willem




Reply via email to