camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Posta <>
Subject Re: freemarker with pojo and/or xpath
Date Wed, 28 Aug 2013 04:01:20 GMT
Yep, totally possible.
So freemarker binds a "context" to the template, and populates the template
body with whatever is found in the "context"
So in the case of Camel integration, Camel will put some parts of the
exchange (and the whole exchange actually) which is then available in the
freemarker template.
The body and headers are all treated as POJOs when they are bound to the
freemarker context, so if you have your own pojo, MyPerson, and you wish
you access its members 'givenName' or 'familyName' within the freemarker
template, you can do so like ${body.givenName} or ${body.familyName}. Same
thing goes for headers.

Have a peek at this unit test to make it more clear:

On Tue, Aug 27, 2013 at 8:44 PM, paulc8712 <> wrote:

> Hi All.
> I'm fairly new to Camel - and very new to Freemarker.
> There doesn't seem to be much out there in the way of camel-freemarker
> examples other than the fairly simplistic email example in
> What I would like to be able to do is use freemarker with either a POJO
> header or body, or XML using xpath.  Is this possible?
> If it is - I would appreciate it greatly if people could share some sample
> freemarker templates that use POJO as the data source.
> Thanks, Paulc
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

*Christian Posta*
twitter: @christianposta

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message