POST/GET Parameters for Camel Jetty Producer

646 views
Skip to first unread message

lukas.kostial

unread,
Nov 6, 2011, 3:07:32 PM11/6/11
to Akka User List
Hi All,

Could you please tell me how to send either GET or POST parameters
with HTTP request produced by Jetty Producer?
It seems that:

protected override def receiveBeforeProduce = {
case whatever => Message("",Map(ParamName->ParamValue))
}

is not enough. I've managed to send GET params by modifying
CamelHttpQuery header but I'm not really sure if this is the best
(nicest) way. Is there any easier/more straightforward way how to do
that?

Thanks,
Lukas

Martin Krasser

unread,
Nov 7, 2011, 12:44:55 AM11/7/11
to akka...@googlegroups.com
Hi Lukas,

Am 06.11.11 21:07, schrieb lukas.kostial:


> Hi All,
>
> Could you please tell me how to send either GET or POST parameters
> with HTTP request produced by Jetty Producer?
> It seems that:
>
> protected override def receiveBeforeProduce = {
> case whatever => Message("",Map(ParamName->ParamValue))
> }
>
> is not enough.

It should work. That's the right way to do it. See also this example:
https://github.com/jboner/akka-modules/blob/v1.2/akka-modules-samples/akka-sample-camel/src/main/scala/sample/camel/Actors.scala#L128

It could be that the camel-http or camel-jetty filters out some headers
before sending the HTTP message (see Camel docs or book for details). A
list of supported headers (that are are used by Camel internally) can be
found at
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java.
Other (i.e. application-specific) headers should work as well.

If you continue to see problems setting HTTP headers this way, please
post an example.

Cheers,
Martin

> I've managed to send GET params by modifying
> CamelHttpQuery header but I'm not really sure if this is the best
> (nicest) way. Is there any easier/more straightforward way how to do
> that?
>
> Thanks,
> Lukas
>

--
Martin Krasser

blog: http://krasserm.blogspot.com
code: http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

Reply all
Reply to author
Forward
0 new messages