This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 98effc5  camel-jslt - add documentation about passing exchange 
information to jslt (#3871)
98effc5 is described below

commit 98effc59ead364859aa4892894451a77bfb5a323
Author: jflabatBCSS <65955832+jflabatb...@users.noreply.github.com>
AuthorDate: Fri May 29 20:24:49 2020 +0200

    camel-jslt - add documentation about passing exchange information to jslt 
(#3871)
---
 .../camel-jslt/src/main/docs/jslt-component.adoc   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/components/camel-jslt/src/main/docs/jslt-component.adoc 
b/components/camel-jslt/src/main/docs/jslt-component.adoc
index 52a6721..4ecf4bd 100644
--- a/components/camel-jslt/src/main/docs/jslt-component.adoc
+++ b/components/camel-jslt/src/main/docs/jslt-component.adoc
@@ -105,8 +105,28 @@ with the following path and query parameters:
 |===
 // endpoint options: END
 
+== Passing values to JSLT
 
+Camel can supply exchange information as variables when applying a JSLT 
expression on the body. The available variables from the *Exchange* are:
 
+[width="100%",cols="2,5",options="header"]
+|===
+| name | value
+| headers | The headers of the In message as a json object
+| exchange.properties | The *Exchange* properties as a json object. _exchange_ 
is the name of the variable and _properties_ is the path to the exchange 
properties. Available if _allowContextMapAll_ option is true.
+|===
+
+All the values that cannot be converted to json with Jackson are denied and 
will not be available in the jslt expression.
+
+For example, the header named "type" and the exchange property "instance" can 
be accessed like
+
+[source,json]
+--------------------------------------
+{
+  "type": $headers.type,
+  "instance": $exchange.properties.instance
+}
+--------------------------------------
 
 == Samples
 
@@ -146,4 +166,12 @@ from("direct:in").
   to("jslt:dummy");
 ---------------------------------------------------------------------
 
+Passing exchange properties to the jslt expression can be done like this
+
+[source,java]
+---------------------------------------------------------------------
+from("direct:in").
+  to("jslt:com/acme/MyResponse.json?allowContextMapAll=true");
+---------------------------------------------------------------------
+
 include::camel-spring-boot::page$jslt-starter.adoc[]

Reply via email to