You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2014/08/06 11:18:09 UTC

svn commit: r918514 - in /websites/production/camel/content: cache/main.pageCache rest-dsl.html

Author: buildbot
Date: Wed Aug  6 09:18:09 2014
New Revision: 918514

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/rest-dsl.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/rest-dsl.html
==============================================================================
--- websites/production/camel/content/rest-dsl.html (original)
+++ websites/production/camel/content/rest-dsl.html Wed Aug  6 09:18:09 2014
@@ -174,7 +174,7 @@
                             <p>In the embedded route you can configure the route settings such as routeId, autoStartup and various other options you can set on routes today.</p><pre>.get().route().routeId("myRestRoute").autoStartup(false).transform().constant("Hello World");</pre>
                     </div>
     </div>
-<h3 id="RestDSL-ManagingRestservices"><span style="line-height: 1.4285715;">&#160;</span><span style="font-size: 16.0px;line-height: 1.5625;">Managing Rest services</span></h3><p>Each of the rest service becomes a Camel route, so in the first example we have 2 x get and 1 x post REST service, which each become a Camel route. This makes it&#160;<em>the same</em> from Camel to manage and run these services - as they are just Camel routes. This means any tooling and API today that deals with Camel routes, also work with the REST services.</p><p>This means you can use JMX to stop/start routes, and also get the JMX metrics about the routes, such as number of message processed, and their performance statistics.</p><h3 id="RestDSL-BindingtoPOJOsusing">Binding to POJOs using</h3><p>The Rest DSL supports automatic binding json/xml contents to/from POJOs using Camels&#160;<a shape="rect" href="data-format.html">Data Format</a>. By default the binding mode is off, meaning there is no automatic
  binding happening for incoming and outgoing messages.</p><p>You may want to use binding if you develop POJOs that maps to your REST services request and response types. This allows you as a developer to work with the POJOs in Java code.</p><p>The binding modes are:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Binding Mode</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">off</td><td colspan="1" rowspan="1" class="confluenceTd">Binding is turned off. This is the default option.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">auto</td><td colspan="1" rowspan="1" class="confluenceTd">Binding is enabled and Camel is relaxed and support json, xml or both if the needed data formats are included in the classpath. Notice that if for example <code>camel-jaxb</code> is not on the classpath, then XML binding is not enabled.</td></t
 r><tr><td colspan="1" rowspan="1" class="confluenceTd">json</td><td colspan="1" rowspan="1" class="confluenceTd">Binding to/from json is enabled, and requires a json capabile data format on the classpath. By default Camel will use <code>json-jackson</code> as the data format.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">xml</td><td colspan="1" rowspan="1" class="confluenceTd">Binding to/from xml is enabled, and requires <code>camel-jaxb</code> on the classpath.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">json_xml</td><td colspan="1" rowspan="1" class="confluenceTd">Biding to/from json and xml is enabled and requires both data formats to be on the classpath.</td></tr></tbody></table></div><p>&#160;</p><p>To use binding you must include the necessary data formats on the classpath, such as&#160;<code>camel-jaxb</code> and/or&#160;<code>camel-jackson</code>. And then enable the binding mode. You can configure the binding mode globally on the rest confi
 guration, and then override per rest service as well.</p><p>To enable binding you configure this in Java DSL as shown below</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h3 id="RestDSL-ManagingRestservices"><span style="font-size: 16.0px;line-height: 1.5625;">Managing Rest services</span></h3><p>Each of the rest service becomes a Camel route, so in the first example we have 2 x get and 1 x post REST service, which each become a Camel route. This makes it&#160;<em>the same</em> from Camel to manage and run these services - as they are just Camel routes. This means any tooling and API today that deals with Camel routes, also work with the REST services.</p><p>This means you can use JMX to stop/start routes, and also get the JMX metrics about the routes, such as number of message processed, and their performance statistics.</p><p>There is also a Rest Registry JMX MBean that contains a registry of all REST services which has been defined.&#160;</p><h3 id="RestDSL-BindingtoPOJOsusing">Binding to POJOs using</h3><p>The Rest DSL supports automatic binding json/xml contents to/from POJOs using Camels&#160;<a shape="rect" href="data-format.html">Data Format
 </a>. By default the binding mode is off, meaning there is no automatic binding happening for incoming and outgoing messages.</p><p>You may want to use binding if you develop POJOs that maps to your REST services request and response types. This allows you as a developer to work with the POJOs in Java code.</p><p>The binding modes are:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Binding Mode</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">off</td><td colspan="1" rowspan="1" class="confluenceTd">Binding is turned off. This is the default option.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">auto</td><td colspan="1" rowspan="1" class="confluenceTd">Binding is enabled and Camel is relaxed and support json, xml or both if the needed data formats are included in the classpath. Notice that if for example <code>camel-jaxb</
 code> is not on the classpath, then XML binding is not enabled.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">json</td><td colspan="1" rowspan="1" class="confluenceTd">Binding to/from json is enabled, and requires a json capabile data format on the classpath. By default Camel will use <code>json-jackson</code> as the data format.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">xml</td><td colspan="1" rowspan="1" class="confluenceTd">Binding to/from xml is enabled, and requires <code>camel-jaxb</code> on the classpath.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">json_xml</td><td colspan="1" rowspan="1" class="confluenceTd">Biding to/from json and xml is enabled and requires both data formats to be on the classpath.</td></tr></tbody></table></div><p>&#160;</p><p>To use binding you must include the necessary data formats on the classpath, such as&#160;<code>camel-jaxb</code> and/or&#160;<code>camel-jackson</code>. And then enable the bind
 ing mode. You can configure the binding mode globally on the rest configuration, and then override per rest service as well.</p><p>To enable binding you configure this in Java DSL as shown below</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[restConfiguration().component(&quot;restlet&quot;).host(&quot;localhost&quot;).port(portNum).bindingMode(RestBindingMode.auto);]]></script>
 </div></div><p>And in XML DSL</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[    &lt;restConfiguration bindingMode=&quot;auto&quot; component=&quot;restlet&quot; port=&quot;8080&quot;/&gt;]]></script>
@@ -236,7 +236,7 @@ public class UserPojo {
 }
 
 ]]></script>
-</div></div><p>By having the JAXB annotations the POJO supports both json and xml bindings.</p><p>&#160;</p><h3 id="RestDSL-ConfiguringRestDSL"><span style="line-height: 1.5625;">Configuring Rest DSL</span></h3><p>The Rest DSL allows to configure the following options using a builder style</p><p>&#160;</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Option</th><th colspan="1" rowspan="1" class="confluenceTh">Default</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">component</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">The Camel Rest component to use for the REST transport, such as restlet, spark-rest. If no component has been explicit configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a&#160;<code>org.apache.camel.sp
 i.RestConsumerFactory</code>&#160;is registered in the registry. If either one is found, then that is being used.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">scheme</td><td colspan="1" rowspan="1" class="confluenceTd">http</td><td colspan="1" rowspan="1" class="confluenceTd">The scheme to use for exposing the REST service. Usually http or https is supported</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">hostname</td><td colspan="1" rowspan="1" class="confluenceTd">0.0.0.0</td><td colspan="1" rowspan="1" class="confluenceTd">The hostname to use for exposing the REST service.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">port</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">The port number to use for exposing the REST service.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">bindingMode</td><td colspan="1" rowspan="1" class="confluenceTd">off</td><td colspan="1
 " rowspan="1" class="confluenceTd">Whether binding is in use. See further above for more details.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">jsonDataFormat</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Name of specific json data format to use. By default <code>json-jackson</code> will be used. <strong>Notice:</strong> Currently Jackson is what we recommend and are using for testing.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">xmlDataFormat</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Name of specific XML data format to use. By default <code>jaxb</code> will be used. <strong>Notice:</strong> Currently only <code>jaxb</code> is supported.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">componentProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="c
 onfluenceTd">Allows to configure as many additional properties. This is used to configure component specific options such as for&#160;<a shape="rect" href="restlet.html">Restlet</a>&#160;/&#160;<a shape="rect" href="spark-rest.html">Spark-Rest</a>&#160;etc.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">endpointProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><span>Allows to configure as many additional properties. This is used to configure endpoint specific options for <span>&#160;</span><a shape="rect" href="restlet.html">Restlet</a><span>&#160;/&#160;</span><a shape="rect" href="spark-rest.html">Spark-Rest</a><span>&#160;etc.</span></span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">consumerProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><span>Allows to configure as many additional properties. This is u
 sed to configure consumer specific options for </span><span>&#160;</span><a shape="rect" href="restlet.html">Restlet</a><span>&#160;/&#160;</span><a shape="rect" href="spark-rest.html">Spark-Rest</a><span>&#160;etc.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">dataFormatProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Allows to configure as many additional properties. This is used to configure the data format specific options. For example set property prettyPrint to true to have json outputted in pretty mode.</td></tr></tbody></table></div><p>&#160;</p><p><span style="line-height: 1.4285715;">For example to configure to use the spark-rest component on port 9091, then we can do as follows</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>By having the JAXB annotations the POJO supports both json and xml bindings.</p><p>&#160;</p><h3 id="RestDSL-ConfiguringRestDSL"><span style="line-height: 1.5625;">Configuring Rest DSL</span></h3><p>The Rest DSL allows to configure the following options using a builder style</p><p>&#160;</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Option</th><th colspan="1" rowspan="1" class="confluenceTh">Default</th><th colspan="1" rowspan="1" class="confluenceTh">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">component</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">The Camel Rest component to use for the REST transport, such as restlet, spark-rest. If no component has been explicit configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a&#160;<code>org.apache.camel.sp
 i.RestConsumerFactory</code>&#160;is registered in the registry. If either one is found, then that is being used.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">scheme</td><td colspan="1" rowspan="1" class="confluenceTd">http</td><td colspan="1" rowspan="1" class="confluenceTd">The scheme to use for exposing the REST service. Usually http or https is supported</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">hostname</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">The hostname to use for exposing the REST service.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">port</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">The port number to use for exposing the REST service.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">restHostNameResolver</td><td colspan="1" rowspan="1" class="confluenceTd">localHostName<
 /td><td colspan="1" rowspan="1" class="confluenceTd">If no hostname has been explicit configured, then this resolver is used to compute the hostname the REST service will be using. The resolver supports <code>localHostName</code> or <code>localIp</code>.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">bindingMode</td><td colspan="1" rowspan="1" class="confluenceTd">off</td><td colspan="1" rowspan="1" class="confluenceTd">Whether binding is in use. See further above for more details.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">jsonDataFormat</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Name of specific json data format to use. By default <code>json-jackson</code> will be used. <strong>Notice:</strong> Currently Jackson is what we recommend and are using for testing.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">xmlDataFormat</td><td colspan="1" rowspan="1" class="conflu
 enceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Name of specific XML data format to use. By default <code>jaxb</code> will be used. <strong>Notice:</strong> Currently only <code>jaxb</code> is supported.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">componentProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Allows to configure as many additional properties. This is used to configure component specific options such as for&#160;<a shape="rect" href="restlet.html">Restlet</a>&#160;/&#160;<a shape="rect" href="spark-rest.html">Spark-Rest</a>&#160;etc.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">endpointProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><span>Allows to configure as many additional properties. This is used to configure endpoint specific options for <span>&#160;</span><a shape="r
 ect" href="restlet.html">Restlet</a><span>&#160;/&#160;</span><a shape="rect" href="spark-rest.html">Spark-Rest</a><span>&#160;etc.</span></span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">consumerProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd"><span>Allows to configure as many additional properties. This is used to configure consumer specific options for </span><span>&#160;</span><a shape="rect" href="restlet.html">Restlet</a><span>&#160;/&#160;</span><a shape="rect" href="spark-rest.html">Spark-Rest</a><span>&#160;etc.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">dataFormatProperty</td><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">Allows to configure as many additional properties. This is used to configure the data format specific options. For example set property prettyPrint to true to have json outputt
 ed in pretty mode.</td></tr></tbody></table></div><p>&#160;</p><p><span style="line-height: 1.4285715;">For example to configure to use the spark-rest component on port 9091, then we can do as follows</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[restConfiguration().component(&quot;spark-rest&quot;).port(9091).componentProperty(&quot;foo&quot;, &quot;123&quot;);]]></script>
 </div></div><p><span style="line-height: 1.4285715;"><br clear="none"></span></p><p><span style="line-height: 1.4285715;">And with XML DSL</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;restConfiguration component=&quot;spark-rest&quot; port=&quot;9091&quot;&gt; &lt;componentProperty key=&quot;foo&quot; value=&quot;123&quot;/&gt; &lt;/restConfiguration&gt;]]></script>