Repository: camel
Updated Branches:
  refs/heads/master 8a1549fe6 -> 45f4b7b2e


CAMEL-10164: swagger component for making rest calls with swagger schema 
validation and facade to actual HTTP client in use


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

Branch: refs/heads/master
Commit: 45f4b7b2ecf158eff397f571806f0e9aa400b660
Parents: 098a67e
Author: Claus Ibsen <[email protected]>
Authored: Fri Aug 26 16:51:01 2016 +0200
Committer: Claus Ibsen <[email protected]>
Committed: Fri Aug 26 16:53:31 2016 +0200

----------------------------------------------------------------------
 camel-core/src/main/docs/rest-component.adoc | 59 +++++++++++++++++++++--
 1 file changed, 56 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/45f4b7b2/camel-core/src/main/docs/rest-component.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/rest-component.adoc 
b/camel-core/src/main/docs/rest-component.adoc
index fca18a8..2413940 100644
--- a/camel-core/src/main/docs/rest-component.adoc
+++ b/camel-core/src/main/docs/rest-component.adoc
@@ -4,10 +4,12 @@ Rest Component
 
 *Available as of Camel 2.14*
 
-The rest component allows to define REST endpoints using the
+The rest component allows to define REST endpoints (consumer) using the
 link:rest-dsl.html[Rest DSL] and plugin to other Camel components as the
 REST transport.
 
+From Camel 2.18 onwards the rest component can also be used as a client 
(producer) to call REST services.
+
 [[Rest-URIformat]]
 URI format
 ^^^^^^^^^^
@@ -98,8 +100,6 @@ header with the key "me".
 The following examples have configured a base path as "hello" and then
 have two REST services configured using uriTemplates.
 
- 
-
 [source,java]
 ------------------------------------------------
   from("rest:get:hello:/{me}")
@@ -109,6 +109,59 @@ have two REST services configured using uriTemplates.
     .transform().simple("Bonjour ${header.me}");
 ------------------------------------------------
 
+[[Rest-Producer]]
+Rest producer examples
+^^^^^^^^^^^^^^^^^^^^^^
+
+You can use the rest component to call REST services like any other Camel 
component.
+
+For example to call a REST service on using `hello/{me}` you can do
+
+[source,java]
+--------------------------------------------
+  from("direct:start")
+    .to("rest:get:hello/{me}");
+--------------------------------------------
+
+And then the dynamic value `{me}` is mapped to Camel message with the same 
name.
+So to call this REST service you can send an empty message body and a header 
as shown:
+
+[source,java]
+--------------------------------------------
+  template.sendBodyAndHeader("direct:start", null, "me", "Donald Duck");
+--------------------------------------------
+
+The Rest producer needs to know the hostname and port of the REST service, 
which you can configure
+using the host option as shown:
+
+[source,java]
+--------------------------------------------
+  from("direct:start")
+    .to("rest:get:hello/{me}?host=myserver:8080/foo");
+--------------------------------------------
+
+Instead of using the host option, you can configure the host on the 
`restConfiguration` as shown:
+
+[source,java]
+--------------------------------------------
+  restConfiguration().host("myserver:8080/foo");
+
+  from("direct:start")
+    .to("rest:get:hello/{me}");
+--------------------------------------------
+
+You can use the `producerComponent` to select which Camel component to use as 
the HTTP client, for example
+to use http4 you can do:
+
+[source,java]
+--------------------------------------------
+  restConfiguration().host("myserver:8080/foo").producerComponent("http4");
+
+  from("direct:start")
+    .to("rest:get:hello/{me}");
+--------------------------------------------
+
+
 [[Rest-Moreexamples]]
 More examples
 ^^^^^^^^^^^^^

Reply via email to