Willem Jiang wrote:
Wayne Keenan wrote:
Hi,
Thanks for replying.
On Wed, Jan 20, 2010 at 3:28 PM, Willem Jiang
<willem.ji...@gmail.com>wrote:
Hi,
Can you try to set the ID into the message header instead of the message
body ? In this way you can the Request object back :)
<route>
<from uri="jetty:http://0.0.0.0:8080/endpoint"/>
<inOnly uri="seda:sendASync"/>
<setHeader headerName="id">
<simple>${id}</simple>
</setHeader>
</route>
<route>
<from uri="seda:sendASync"/>
<to uri="bean:myBean"/>
</route>
You bean's method could
public String controller(@Header("id")String body, Exchange exchange) ;
The request body contains base64 encoded POST I want.
I can get to the body, url paramters and the ID ok without the
intermediate
SEDA route, in the bean I have:
HttpServletRequest req =
exchange.getIn().getBody(HttpServletRequest.class);
def corrId = exchange.getIn().getMessageId()
It looks the seda endpoint didn't copy the message body of the
HttpServletRequest.
I will write a simple unit test to verify it.
I did a quick test as your said, and found the HttpServletRequest and
HttpServletResponse objects are stored in the HttpMessage which is
extended from the DefaultMessage,
When the exchange is copy from the jetty endpoint to other endpoints,
these HttpMessage members will not be copyed.
You need to make sure what you want is put into message header before
pass this message to the
I also can get to the URL (not form encoded) parameters (e.g. the
URL is:
http://0.0.0.0:65503/endpoint?myParam=value) by using:
def p1 = req?.getParameter('myParam')
It's ony when I introduce the SEDA that the HttpServletRequest no longer
exists, (I think), and I am unable to obtain the HTTP parameters from
the
URL
Perhaps I should be copying the HTTP parameters to Camel message
properties? That way my bean can be less dependent on the HTTP protocol.
Yes, that could be another solution.
You can get the Parameter from the message header like this
Exchange.getIn().getHeader("myParam");
Is that something someone would be able to give me an example of
please? Is
there a built-in way to auto populate Camel message properties with HTTP
properties
Alternatively, sticking with HTTP aware bean,I just get null using:
println exchange.getProperty(Exchange.HTTP_QUERY)
or
println exchange.getIn().getProperty(Exchange.HTTP_QUERY)
The HTTP_QUERY is a message header.
You can get it like this
exchange.getIn().getHeader(Exchange.HTTP_QUERY)
Regards
Wayne
Willem
BTW, seda support the Request/Response pattern in Camel 2.x.
If you are using Camel 2.x, you don't need to set the MEP to be InOnly.
Willem