LibraryToggle FramesPrintFeedback

Available as of Fuse Mediation Router 1.6

The freemarker: component allows you to process a message using a FreeMarker template. This can be ideal when using Templating to generate responses for requests.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-freemarker</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Option Default Description
contentCache true Cache for the resource content when its loaded.
encoding null Character encoding of the resource content.

Fuse Mediation Router will provide exchange information in the FreeMarker context (just a Map). The Exchange is transfered as:

Key Value
exchange The Exchange itself.
headers The headers of the In message.
camelContext The Camel Context.
request The In message.
body The In message body.
response The Out message (only for InOut message exchange pattern).

Available as of Camel 2.1 Camel provides two headers by which you can define a different resource location for a template or the template content itself. If any of these headers is set then Camel uses this over the endpoint configured resource. This allows you to provide a dynamic template at runtime.

Header Type Description Support Version
FreemarkerConstants.FREEMARKER_RESOURCE org.springframework.core.io.Resource The template resource <= 1.6.2, <= 2.1
FreemarkerConstants.FREEMARKER_RESOURCE_URI String A URI for the template resource to use instead of the endpoint configured. >= 2.1
FreemarkerConstants.FREEMARKER_TEMPLATE String The template to use instead of the endpoint configured. >= 2.1
Comments powered by Disqus