Hi,

I am in the process of creating a Camel-based proxy that takes in requests
on a Tomcat Servlet, does some internal processing, and ultimately returns
the responses that you would expect when accessing the targeted server
itself.

In its simplest implementation this works just fine for GET and DELETE
requests.

from("servlet:///tinyproxy")
.log("${body}")
.to("ahc:
http://localhost/api/servers?bridgeEndpoint=true&throwExceptionOnFailure=false
");

However, when I try to do the same with an AHC component, the body* of POST
and PUT requests is not being received at the other end.

If I change the module to http4, the body of the request is received, and
the appropriate response is forwarded back to the sender.

from("servlet:///tinyproxy2")
.log("${body}")
.to("http4:localhost/api/servers?bridgeEndpoint=true&throwExceptionOnFailure=false");

The log message does actually print the body as it is provided by the
original request, so that should confirm that the setup of Camel/Tomcat
should be OK.

*Here are some very simple examples of request bodies that fail to be
passed through when using AHC.

JSON: (using single quotes to avoid parsing issues with Camel)
{'HostName':'DEVSERVER'}

XML:
<ServerDetails xmlns:i="http://www.w3.org/2001/XMLSchema-instance"; xmlns="
http://schemas.datacontract.org/2004/07/HttpTests.Models";>
<HostName>DEVServer</HostName>
</ServerDetails>

This is occurring with the version 2.13.2 of all components: camel-core,
camel-servletlistener, camel-http4, camel-ahc
I'm sending the http requests with Curl.

Could I be missing something entirely obvious?


Thanks,

Jaume

Reply via email to