Modified: websites/production/camel/content/rest.html ============================================================================== --- websites/production/camel/content/rest.html (original) +++ websites/production/camel/content/rest.html Wed May 24 13:19:16 2017 @@ -87,14 +87,13 @@ <div class="wiki-content maincontent"><h2 id="Rest-RestComponent">Rest Component</h2><p><strong>Available as of Camel 2.14</strong></p><p>The rest component allows to define REST endpoints using the <a shape="rect" href="rest-dsl.html">Rest DSL</a> and plugin to other Camel components as the REST transport.</p><p> </p><h3 id="Rest-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ rest://method:path[:uriTemplate]?[options] ]]></script> -</div></div><h3 id="Rest-URIOptions"><span style="line-height: 1.5625;font-size: 16.0px;">URI Options</span></h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Name </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Default Value </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> method </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> HTTP method which should be one of: get, post, put, patch, delete, head, trace, connect, or options. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> path </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> the base path which support REST syntax. See further below for examples. </p></td></tr><tr><td co lspan="1" rowspan="1" class="confluenceTd"><p> uriTemplate </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> uri template which support REST syntax. See further below for examples. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> consumes </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> media type such as: 'text/xml', or 'application/json' this REST service accepts. By default we accept all kinds of types. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> produces </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> media type such as: 'text/xml', or 'application/json' this REST service returns. </p></td></tr></tbody></table></div> -<h3 id="Rest-PathanduriTemplatesyntax">Path and uriTemplate syntax</h3><p>The path and uriTemplate option is defined using a REST syntax where you define the REST context path using support for parameters. </p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If no uriTemplate is configured then path option works the same way. It does not matter if you configure only path or if you configure both options. Though configuring both a path and uriTemplate is a more common practice with REST.</p></div></div><p> </p><p>The following is a Camel route using a a path only</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="Rest-URIOptions"><span style="line-height: 1.5625;font-size: 16.0px;">URI Options</span></h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>method</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>HTTP method which should be one of:</p><ul><li><strong><code>get</code></strong></li><li><strong><code>post</code></strong></li><li><strong><code>put</code></strong></li><li><strong><code>patch</code></strong></li><li><strong><code>delete</code></strong></li><li><strong><code>head</code></strong></li><li><strong><code>trace</code></strong></li><li><strong><code>connect</code></strong></li><li><st rong><code>options</code></strong></li></ul></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>path</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The base path which support REST syntax.</p><p>See further below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>uriTemplate</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>URI template which support REST syntax.</p><p>See further below for examples.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>consumes</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Media type such as: <strong><code>text/xml</code></strong> or <strong><code>application/json</code></strong> this REST service accepts.</p><p >By default we accept all kinds of types.</p></td></tr><tr><td colspan="1" >rowspan="1" class="confluenceTd"><p><code>produces</code></p></td><td >colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td >colspan="1" rowspan="1" class="confluenceTd"><p>Media type such >as: <strong><code>text/xml</code></strong> >or <strong><code>application/json</code></strong> this REST service >returns.</p></td></tr></tbody></table></div><h3 >id="Rest-PathanduriTemplatesyntax">Path and <code>uriTemplate</code> >syntax</h3><p>The path and <strong><code>uriTemplate</code></strong> >option is defined using a REST syntax where you define the REST context path >using support for parameters. </p><div >class="confluence-information-macro confluence-information-macro-tip"><span >class="aui-icon aui-icon-small aui-iconfont-approve >confluence-information-macro-icon"></span><div >class="confluence-information-macro-body"><p>If >no <strong><code>uriTemplate</code></strong> is configu red then path option works the same way. It does not matter if you configure only path or if you configure both options. Though configuring both a path and <strong><code>uriTemplate</code></strong> is a more common practice with REST.</p></div></div><p> </p><p>The following is a Camel route using a a path only</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ from("rest:get:hello") .transform().constant("Bye World");]]></script> -</div></div><p>And the following route uses a parameter which is mapped to a Camel header with the key "me".</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>And the following route uses a parameter which is mapped to a Camel header with the key <strong><code>me</code></strong>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ from("rest:get:hello/{me}") .transform().simple("Bye ${header.me}");]]></script> -</div></div><p><span style="line-height: 1.5625;"><br clear="none"></span></p><p><span style="line-height: 1.5625;">The following examples have configured a base path as "hello" and then have two REST services configured using uriTemplates.</span></p><p><span style="line-height: 1.5625;"> </span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p><span style="line-height: 1.5625;"><br clear="none"></span></p><p><span style="line-height: 1.5625;">The following examples have configured a base path as <strong><code>hello</code></strong> and then have two REST services configured using <strong><code>uriTemplate</code></strong>'s.</span></p><p><span style="line-height: 1.5625;"> </span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ from("rest:get:hello:/{me}") .transform().simple("Hi ${header.me}"); Â