Repository: camel
Updated Branches:
  refs/heads/master 1ec00be81 -> 8ed65a952


Added camel-ognl docs to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8ed65a95
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ed65a95
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ed65a95

Branch: refs/heads/master
Commit: 8ed65a95221ebc1754cef1602148105b13081c9f
Parents: 1ec00be
Author: Andrea Cosentino <anco...@gmail.com>
Authored: Mon May 16 08:50:18 2016 +0200
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Mon May 16 08:50:30 2016 +0200

----------------------------------------------------------------------
 components/camel-ognl/src/main/docs/ognl.adoc | 117 +++++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                |   1 +
 2 files changed, 118 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8ed65a95/components/camel-ognl/src/main/docs/ognl.adoc
----------------------------------------------------------------------
diff --git a/components/camel-ognl/src/main/docs/ognl.adoc 
b/components/camel-ognl/src/main/docs/ognl.adoc
new file mode 100644
index 0000000..c3d6344
--- /dev/null
+++ b/components/camel-ognl/src/main/docs/ognl.adoc
@@ -0,0 +1,117 @@
+[[OGNL-OGNL]]
+OGNL
+~~~~
+
+Camel allows http://commons.apache.org/proper/commons-ognl/[OGNL] to be
+used as an link:expression.html[Expression] or
+link:predicate.html[Predicate] the link:dsl.html[DSL] or
+link:xml-configuration.html[Xml Configuration].
+
+You could use OGNL to create an link:predicate.html[Predicate] in a
+link:message-filter.html[Message Filter] or as an
+link:expression.html[Expression] for a
+link:recipient-list.html[Recipient List]
+
+You can use OGNL dot notation to invoke operations. If you for instance
+have a body that contains a POJO that has a `getFamilyName` method then
+you can construct the syntax as follows:
+
+[source,java]
+----------------------------------------
+"request.body.familyName"
+   // or 
+"getRequest().getBody().getFamilyName()"
+----------------------------------------
+
+[[OGNL-Variables]]
+Variables
+^^^^^^^^^
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Variable |Type |Description
+
+|*this* |Exchange |the Exchange is the root object
+
+|exchange |Exchange |the Exchange object
+
+|exception |Throwable |the Exchange exception (if any)
+
+|exchangeId |String |the exchange id
+
+|fault |Message |the Fault message (if any)
+
+|request |Message |the exchange.in message
+
+|response |Message |the exchange.out message (if any)
+
+|properties |Map |the exchange properties
+
+|property(name) |Object |the property by the given name
+
+|property(name, type) |Type |the property by the given name as the given type
+|=======================================================================
+
+[[OGNL-Samples]]
+Samples
+^^^^^^^
+
+For example you could use OGNL inside a link:message-filter.html[Message
+Filter] in XML
+
+[source,java]
+---------------------------------------------
+<route>
+  <from uri="seda:foo"/>
+  <filter>
+    <ognl>request.headers.foo == 'bar'</ognl>
+    <to uri="seda:bar"/>
+  </filter>
+</route>
+---------------------------------------------
+
+And the sample using Java DSL:
+
+[source,java]
+---------------------------------------------------------------------------------
+   from("seda:foo").filter().ognl("request.headers.foo == 
'bar'").to("seda:bar");
+---------------------------------------------------------------------------------
+
+[[OGNL-Loadingscriptfromexternalresource]]
+Loading script from external resource
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.11*
+
+You can externalize the script and have Camel load it from a resource
+such as `"classpath:"`, `"file:"`, or `"http:"`. +
+ This is done using the following syntax: `"resource:scheme:location"`,
+eg to refer to a file on the classpath you can do:
+
+[source,java]
+------------------------------------------------------------
+.setHeader("myHeader").ognl("resource:classpath:myognl.txt")
+------------------------------------------------------------
+
+[[OGNL-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use OGNL in your camel routes you need to add the a dependency on
+*camel-ognl* which implements the OGNL language.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+link:download.html[the download page for the latest versions]).
+
+[source,java]
+-------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-ognl</artifactId>
+  <version>x.x.x</version>
+</dependency>
+-------------------------------------
+
+Otherwise, you'll also need
+http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ognl/2.7.3_4/org.apache.servicemix.bundles.ognl-2.7.3_4.jar[OGNL]

http://git-wip-us.apache.org/repos/asf/camel/blob/8ed65a95/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index f96e552..acb6a9b 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -226,6 +226,7 @@
     * [EL](juel.adoc)
     * [Jsonpath](jsonpath.adoc)
     * [JXPath](jxpath.adoc)
+    * [Ognl](ognl.adoc)
     * [SQL](josql.adoc)
 
 * Data Formats

Reply via email to