camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Calling setHeader() after to()
Date Thu, 15 Oct 2009 06:37:51 GMT
On Wed, Oct 14, 2009 at 11:07 PM, Dragisa Krsmanovic
<dkrsmanovic@plos.org> wrote:
> On Wed, 2009-10-14 at 05:58 +0200, Claus Ibsen wrote:
>> Ah the reason is that the javac and generics is limited in terms of DSL wise.
>>
>> What you need to do is to pass in the xpath as a 2nd parameter to setHeader.
>>
>> This
>>    .setHeader(DOI).xpath("/ambraMessage/doi/text()", String.class)
>>
>> Should be
>>    .setHeader(DOI, xpath("/ambraMessage/doi/text()", String.class))
>>
>
> I don't seem to have luck with this. This doesn't compile:
>
> from("activemq:plos.pmc")
>  .setHeader(DOI, xpath("/ambraMessage/doi/text()", String.class))
>  .to("mock:end");
>
> xpath() is not defined in RouteBuilder.

Dont your IDE have good help? IDEA pop up with a list of suggestions :)

You need to static import from XPathBuilder:

import static org.apache.camel.builder.xml.XPathBuilder.xpath;

>
> --
> Dragisa Krsmanovic
> Java Developer
> Public Library of Science
> http://www.plos.org
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message