Author: buildbot Date: Tue Jul 29 08:18:32 2014 New Revision: 917775 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 Tue Jul 29 08:18:32 2014 @@ -84,7 +84,7 @@ <tbody> <tr> <td valign="top" width="100%"> -<div class="wiki-content maincontent"><h2 id="RestDSL-RestDSL">Rest DSL</h2><p><strong>Available as of Camel 2.14</strong></p><p>Apache Camel offers a REST styled DSL which can be used with Java or XML. The intention is to allow end users to define REST services using a REST style with verbs such as get, post, delete etc.</p><h4 id="RestDSL-Howitworks">How it works</h4><p>The Rest DSL is a facade that builds <a shape="rect" href="rest.html">Rest</a> endpoints as consumers for Camel routes. The actual REST transport is leveraged by using Camel REST components such as <a shape="rect" href="restlet.html">Restlet</a>, <a shape="rect" href="spark-rest.html">Spark-rest</a>, and others that has native REST integration.</p><h3 id="RestDSL-ComponentssupportingRestDSL">Components supporting Rest DSL</h3><p>The following Camel components supports the Rest DSL. See the bottom of this page for how to integrate a component with the Rest DSL.</p><ul><li>camel-jetty</li><li>camel-res tlet</li><li>camel-servlet</li><li>camel-spark-rest</li></ul><h3 id="RestDSL-RestDSLwithJava">Rest DSL with Java</h3><p>To use the Rest DSL in Java then just do as with regular Camel routes by extending the <code>RouteBuilder</code> and define the routes in the <code>configure</code> method.</p><p>A simple REST service can be define as follows, where we use rest() to define the services as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<div class="wiki-content maincontent"><h2 id="RestDSL-RestDSL">Rest DSL</h2><p><strong>Available as of Camel 2.14</strong></p><p>Apache Camel offers a REST styled DSL which can be used with Java or XML. The intention is to allow end users to define REST services using a REST style with verbs such as get, post, delete etc.</p><h4 id="RestDSL-Howitworks">How it works</h4><p>The Rest DSL is a facade that builds <a shape="rect" href="rest.html">Rest</a> endpoints as consumers for Camel routes. The actual REST transport is leveraged by using Camel REST components such as <a shape="rect" href="restlet.html">Restlet</a>, <a shape="rect" href="spark-rest.html">Spark-rest</a>, and others that has native REST integration.</p><h3 id="RestDSL-ComponentssupportingRestDSL">Components supporting Rest DSL</h3><p>The following Camel components supports the Rest DSL. See the bottom of this page for how to integrate a component with the Rest DSL.</p><ul><li><a shape="rect" href="netty-h ttp.html">camel-netty-http</a></li><li><a shape="rect" href="jetty.html">camel-jetty</a></li><li><a shape="rect" href="restlet.html">camel-restlet</a></li><li><a shape="rect" href="servlet.html">camel-servlet</a></li><li><a shape="rect" href="spark-rest.html">camel-spark-rest</a></li></ul><h3 id="RestDSL-RestDSLwithJava">Rest DSL with Java</h3><p>To use the Rest DSL in Java then just do as with regular Camel routes by extending the <code>RouteBuilder</code> and define the routes in the <code>configure</code> method.</p><p>A simple REST service can be define as follows, where we use rest() to define the services 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[ protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override @@ -240,7 +240,7 @@ public class UserPojo { <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[restConfiguration().component("spark-rest").port(9091).componentProperty("foo", "123");]]></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[<restConfiguration component="spark-rest" port="9091"> <componentProperty key="foo" value="123"/> </restConfiguration>]]></script> -</div></div><p><span style="line-height: 1.4285715;"><br clear="none"></span></p><p>You can configure properties on three levels. </p><ul><li>component - Is used to set any options on the Component class. You can also configure these directly on the component.</li><li>endpoint - Is used set any option on the endpoint level. Many of the Camel components has many options you can set on endpoint level.</li><li>consumer - Is used to set any option on the consumer level. Some components has consumer options, which you can also configure from endpoint level by prefixing the option with "consumer." </li></ul><p>You can set multiple options of the same level, so you can can for example configure 2 component options, and 3 endpoint options etc.</p><h3 id="RestDSL-IntegrationaCamelcomponentwithRestDSL">Integration a Camel component with Rest DSL</h3><p>Any Apache Camel component can integrate with the Rest DSL if they can be used as a REST service (eg as a REST consumer in Camel lin go). To integrate with the Rest DSL, then the component should implement the <code>org.apache.camel.spi.RestConsumerFactory</code>. The Rest DSL will then invoke the <code>createConsumer</code> method when it setup the Camel routes from the defined DSL. The component should then implement logic to create a Camel consumer that exposes the REST services based on the given parameters, such as path, verb, and other options. For example see the source code for camel-restlet, camel-spark-rest.</p><p> </p><h3 id="RestDSL-SeeAlso">See Also</h3><p><a shape="rect" href="dsl.html">DSL</a></p><p><a shape="rect" href="rest.html">Rest</a></p><p><a shape="rect" href="restlet.html">Restlet</a></p><p><a shape="rect" href="spark-rest.html">Spark-rest</a></p></div> +</div></div><p><span style="line-height: 1.4285715;"><br clear="none"></span></p><p>You can configure properties on three levels. </p><ul><li>component - Is used to set any options on the Component class. You can also configure these directly on the component.</li><li>endpoint - Is used set any option on the endpoint level. Many of the Camel components has many options you can set on endpoint level.</li><li>consumer - Is used to set any option on the consumer level. Some components has consumer options, which you can also configure from endpoint level by prefixing the option with "consumer." </li></ul><p>You can set multiple options of the same level, so you can can for example configure 2 component options, and 3 endpoint options etc.</p><h3 id="RestDSL-IntegrationaCamelcomponentwithRestDSL">Integration a Camel component with Rest DSL</h3><p>Any Apache Camel component can integrate with the Rest DSL if they can be used as a REST service (eg as a REST consumer in Camel lin go). To integrate with the Rest DSL, then the component should implement the <code>org.apache.camel.spi.RestConsumerFactory</code>. The Rest DSL will then invoke the <code>createConsumer</code> method when it setup the Camel routes from the defined DSL. The component should then implement logic to create a Camel consumer that exposes the REST services based on the given parameters, such as path, verb, and other options. For example see the source code for camel-restlet, camel-spark-rest.</p><p> </p><h3 id="RestDSL-SeeAlso">See Also</h3><p><a shape="rect" href="dsl.html">DSL</a></p><p><a shape="rect" href="rest.html">Rest</a></p><p><a shape="rect" href="spark-rest.html">Spark-rest</a></p></div> </td> <td valign="top"> <div class="navigation">