Freemarker
Render a FreeMarker template with the data of the message and use the text it writes as the new message body.
What’s inside
-
Freemarker component, URI syntax:
freemarker:resourceUri
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-freemarker-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 8 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.freemarker.allow-context-map-all | Whether the data model that the producer builds from the exchange also has the exchange, in, request, out, response, exchangeProperty, exchangeProperties and camelContext entries. If false, it has only the body, header, headers, variable, variables and exception entries. Enabling it gives the template the whole Exchange and CamelContext API. The default for the endpoints of the component. | false | Boolean |
camel.component.freemarker.allow-template-from-header | Whether the producer reads the CamelFreemarkerResourceUri, CamelFreemarkerTemplate and CamelFreemarkerDataModel headers. If false, the producer ignores all three headers. A template from a header can do all that FreeMarker allows, such as calling the methods of the objects in the data model and, with the default settings of FreeMarker, running commands with the ?new built-in, and the CamelFreemarkerResourceUri header can name any resource, such as a file or an http URL. Enable it only when the route sets these headers, not a message sender. | false | Boolean |
camel.component.freemarker.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.freemarker.configuration | The freemarker.template.Configuration for the endpoints of the component, each of which uses a copy (clone) of it. If not set, the component creates one with incompatible improvements 2.3.34 and a template loader that loads the templates through Camel, from the classpath unless the name has a scheme such as file:, and applies localizedLookup. The option is a freemarker.template.Configuration type. | Configuration | |
camel.component.freemarker.content-cache | Whether the endpoints of the component cache their template, unless the contentCache option of the endpoint says otherwise. The producer reads a resourceUri with a scheme, such as classpath: or file:, once and keeps its content. A resourceUri without a scheme is loaded by FreeMarker, whose template cache checks whether the template changed once templateUpdateDelay has passed. If false, FreeMarker caches no templates and the producer reads the template on each exchange. | true | Boolean |
camel.component.freemarker.enabled | Whether to enable auto configuration of the freemarker component. This is enabled by default. | Boolean | |
camel.component.freemarker.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.freemarker.localized-lookup | Whether FreeMarker looks for a localized variant of a template first: for foo.ftl and the locale en_US, the default locale of the JVM, it tries foo_en_US.ftl, foo_en.ftl and then foo.ftl. Only for the templates that FreeMarker loads, which are a resourceUri without a scheme and the templates of #include and #import. Not used when the configuration option is set. | false | Boolean |