<commit_before>[[Mustache-Mustache]]
Mustache
~~~~~~~~

*Available as of Camel 2.12*

The *mustache:* component allows for processing a message using a
http://mustache.github.io/[Mustache] template. This can be ideal when
using link:templating.html[Templating] to generate responses for
requests.

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

[source,xml]
---------------------------------------------------------------------------------
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mustache</artifactId>
<version>x.x.x</version> <!-- use the same version as your Camel core version -->
</dependency>
---------------------------------------------------------------------------------

[[Mustache-URIformat]]
URI format
^^^^^^^^^^

[source,java]
-------------------------------
mustache:templateName[?options]
-------------------------------

Where *templateName* is the classpath-local URI of the template to
invoke; or the complete URL of the remote template (eg:
file://folder/myfile.mustache[file://folder/myfile.mustache]).

You can append query options to the URI in the following format,
`?option=value&option=value&...`

[[Mustache-Options]]
Options
^^^^^^^


// component options: START
The Mustache component supports 1 options which are listed below.



[width="100%",cols="2s,1m,8",options="header"]
|=======================================================================
| Name | Java Type | Description
| mustacheFactory | MustacheFactory | To use a custom MustacheFactory
|=======================================================================
// component options: END



// endpoint options: START
The Mustache component supports 7 endpoint options which are listed below:

[width="100%",cols="2s,1,1m,1m,5",options="header"]
|=======================================================================
| Name | Group | Default | Java Type | Description
| resourceUri | producer |  | String | *Required* Path to the resource or a reference to lookup a bean in the Registry to use as the resource
| contentCache | producer | false | boolean | Sets whether to use resource content cache or not
| encoding | producer |  | String | Character encoding of the resource content.
| endDelimiter | producer | "\}\}" | String | Characters used to mark template code end.
| startDelimiter | producer | "\{\{" | String | Characters used to mark template code beginning.
| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
|=======================================================================
// endpoint options: END


[[Mustache-MustacheContext]]
Mustache Context
^^^^^^^^^^^^^^^^

Camel will provide exchange information in the Mustache context (just a
`Map`). The `Exchange` is transferred as:

[width="100%",cols="10%,90%",options="header",]
|=======================================================================
|key |value

|`exchange` |The `Exchange` itself.

|`exchange.properties` |The `Exchange` properties.

|`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).
|=======================================================================
<commit_msg>Component docs<commit_after>[[Mustache-Mustache]]
Mustache
~~~~~~~~

*Available as of Camel 2.12*

The *mustache:* component allows for processing a message using a
http://mustache.github.io/[Mustache] template. This can be ideal when
using link:templating.html[Templating] to generate responses for
requests.

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

[source,xml]
---------------------------------------------------------------------------------
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mustache</artifactId>
<version>x.x.x</version> <!-- use the same version as your Camel core version -->
</dependency>
---------------------------------------------------------------------------------

[[Mustache-URIformat]]
URI format
^^^^^^^^^^

[source,java]
-------------------------------
mustache:templateName[?options]
-------------------------------

Where *templateName* is the classpath-local URI of the template to
invoke; or the complete URL of the remote template (eg:
file://folder/myfile.mustache[file://folder/myfile.mustache]).

You can append query options to the URI in the following format,
`?option=value&option=value&...`

[[Mustache-Options]]
Options
^^^^^^^


// component options: START
The Mustache component supports 1 options which are listed below.



[width="100%",cols="2s,1m,8",options="header"]
|=======================================================================
| Name | Java Type | Description
| mustacheFactory | MustacheFactory | To use a custom MustacheFactory
|=======================================================================
// component options: END




// endpoint options: START
The Mustache component supports 7 endpoint options which are listed below:

[width="100%",cols="2s,1,1m,1m,5",options="header"]
|=======================================================================
| Name | Group | Default | Java Type | Description
| resourceUri | producer |  | String | *Required* Path to the resource or a reference to lookup a bean in the Registry to use as the resource
| contentCache | producer | false | boolean | Sets whether to use resource content cache or not
| encoding | producer |  | String | Character encoding of the resource content.
| endDelimiter | producer | }} | String | Characters used to mark template code end.
| startDelimiter | producer | {{ | String | Characters used to mark template code beginning.
| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
|=======================================================================
// endpoint options: END



[[Mustache-MustacheContext]]
Mustache Context
^^^^^^^^^^^^^^^^

Camel will provide exchange information in the Mustache context (just a
`Map`). The `Exchange` is transferred as:

[width="100%",cols="10%,90%",options="header",]
|=======================================================================
|key |value

|`exchange` |The `Exchange` itself.

|`exchange.properties` |The `Exchange` properties.

|`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).
|=======================================================================

{'fraction_non_alphanumeric': 0.2824762714265477, 'fraction_numerical': 0.007366482504604052, 'mean_word_length': 4.014204545454546, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5826611', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1635, 'n_words': 631}