camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [28/33] git commit: CAMEL-7364: Rest DSL allow to configure rest usign restConfiguration. Added rest DSL support to camel-restlet.
Date Sun, 20 Jul 2014 06:53:34 GMT
CAMEL-7364: Rest DSL allow to configure rest usign restConfiguration. Added rest DSL support to camel-restlet.


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

Branch: refs/heads/master
Commit: 2f856a6bf67ad994e48a950e4f6dc1e859e287b8
Parents: b2f4196
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jul 17 20:56:36 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Jul 19 09:38:53 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/CamelContext.java     |  15 +++
 .../org/apache/camel/builder/RouteBuilder.java  |  21 +++-
 .../camel/component/rest/RestComponent.java     |   5 +
 .../apache/camel/impl/DefaultCamelContext.java  |  21 ++--
 .../apache/camel/model/ModelCamelContext.java   |  11 --
 .../model/rest/RestConfigurationDefinition.java |  51 +++++++++
 .../apache/camel/model/rest/RestDefinition.java |   7 +-
 .../org/apache/camel/spi/RestConfiguration.java | 104 +++++++++++++++++++
 .../org/apache/camel/model/rest/jaxb.index      |   3 +
 .../rest/FromRestConfigurationTest.java         |  54 ++++++++++
 .../blueprint/CamelContextFactoryBean.java      |   2 +-
 .../camel/blueprint/BlueprintJaxbRestTest.java  |   4 +
 .../src/test/resources/test-rest.xml            |   2 +-
 .../xml/AbstractCamelContextFactoryBean.java    |   3 +-
 .../component/restlet/RestletComponent.java     |  23 ++--
 .../component/sparkrest/SparkComponent.java     |  10 ++
 .../RestConfigurationCamelSparkTest.java        |  75 +++++++++++++
 .../camel/spring/CamelContextFactoryBean.java   |   2 +-
 .../spring/handler/CamelNamespaceHandler.java   |   1 +
 .../rest/SpringFromRestConfigurationTest.java   |  29 ++++++
 .../rest/SpringFromRestConfigurationTest.xml    |  61 +++++++++++
 .../rest/FromRestConfigurationTest.java         |  37 +++++++
 .../rest/FromRestConfigurationTest.xml          |  59 +++++++++++
 23 files changed, 555 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index d1156fd..96f6374 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -51,6 +51,7 @@ import org.apache.camel.spi.NodeIdFactory;
 import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.ProcessorFactory;
 import org.apache.camel.spi.Registry;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RouteStartupOrder;
 import org.apache.camel.spi.RuntimeEndpointRegistry;
 import org.apache.camel.spi.ServicePool;
@@ -406,6 +407,20 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
     void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception;
 
     /**
+     * Sets a custom {@link org.apache.camel.spi.RestConfiguration}
+     *
+     * @param restConfiguration the REST configuration
+     */
+    void setRestConfiguration(RestConfiguration restConfiguration);
+
+    /**
+     * Gets the current REST configuration
+     *
+     * @return the configuration, or <tt>null</tt> if none has been configured.
+     */
+    RestConfiguration getRestConfiguration();
+
+    /**
      * Returns the order in which the route inputs was started.
      * <p/>
      * The order may not be according to the startupOrder defined on the route.

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
index 903ad41..c53979e 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
@@ -33,6 +33,7 @@ import org.apache.camel.model.RoutesDefinition;
 import org.apache.camel.model.rest.RestConfigurationDefinition;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestsDefinition;
+import org.apache.camel.spi.RestConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,6 +47,7 @@ public abstract class RouteBuilder extends BuilderSupport implements RoutesBuild
     protected Logger log = LoggerFactory.getLogger(getClass());
     private AtomicBoolean initialized = new AtomicBoolean(false);
     private RestsDefinition restCollection = new RestsDefinition();
+    private RestConfigurationDefinition restConfiguration;
     private RoutesDefinition routeCollection = new RoutesDefinition();
 
     public RouteBuilder() {
@@ -72,16 +74,15 @@ public abstract class RouteBuilder extends BuilderSupport implements RoutesBuild
     public abstract void configure() throws Exception;
 
     /**
-     * Creates a new REST service
+     * Configures the REST services
      *
      * @return the builder
      */
     public RestConfigurationDefinition restConfiguration() {
-        if (getContext().getRestConfigurationDefinition() == null) {
-            RestConfigurationDefinition config = new RestConfigurationDefinition();
-            getContext().setRestConfigurationDefinition(config);
+        if (restConfiguration == null) {
+            restConfiguration = new RestConfigurationDefinition();
         }
-        return getContext().getRestConfigurationDefinition();
+        return restConfiguration;
     }
 
     /**
@@ -401,6 +402,12 @@ public abstract class RouteBuilder extends BuilderSupport implements RoutesBuild
             throw new IllegalArgumentException("CamelContext has not been injected!");
         }
         getRestCollection().setCamelContext(camelContext);
+
+        // setup rest configuration before adding the rests
+        if (getRestConfiguration() != null) {
+            RestConfiguration config = getRestConfiguration().asRestConfiguration(getContext());
+            camelContext.setRestConfiguration(config);
+        }
         camelContext.addRestDefinitions(getRestCollection().getRests());
     }
 
@@ -408,6 +415,10 @@ public abstract class RouteBuilder extends BuilderSupport implements RoutesBuild
         return restCollection;
     }
 
+    public RestConfigurationDefinition getRestConfiguration() {
+        return restConfiguration;
+    }
+
     public void setRestCollection(RestsDefinition restCollection) {
         this.restCollection = restCollection;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/component/rest/RestComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/rest/RestComponent.java b/camel-core/src/main/java/org/apache/camel/component/rest/RestComponent.java
index efa2990..d595de6 100644
--- a/camel-core/src/main/java/org/apache/camel/component/rest/RestComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/rest/RestComponent.java
@@ -44,6 +44,11 @@ public class RestComponent extends UriEndpointComponent {
         answer.setVerb(verb);
         answer.setPath(path);
 
+        // if no explicit component name was given, then fallback and use default configured component name
+        if (answer.getComponentName() == null && getCamelContext().getRestConfiguration() != null) {
+            answer.setComponentName(getCamelContext().getRestConfiguration().getComponent());
+        }
+
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 09884cf..5e75018 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -82,7 +82,6 @@ import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.model.RouteDefinitionHelper;
 import org.apache.camel.model.RoutesDefinition;
-import org.apache.camel.model.rest.RestConfigurationDefinition;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.processor.interceptor.BacklogDebugger;
 import org.apache.camel.processor.interceptor.BacklogTracer;
@@ -116,6 +115,7 @@ import org.apache.camel.spi.NodeIdFactory;
 import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.ProcessorFactory;
 import org.apache.camel.spi.Registry;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.spi.RouteStartupOrder;
 import org.apache.camel.spi.RuntimeEndpointRegistry;
@@ -174,7 +174,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     private ManagementMBeanAssembler managementMBeanAssembler;
     private final List<RouteDefinition> routeDefinitions = new ArrayList<RouteDefinition>();
     private final List<RestDefinition> restDefinitions = new ArrayList<RestDefinition>();
-    private RestConfigurationDefinition restConfigurationDefinition = new RestConfigurationDefinition();
+    private RestConfiguration restConfiguration;
     private List<InterceptStrategy> interceptStrategies = new ArrayList<InterceptStrategy>();
 
     // special flags to control the first startup which can are special
@@ -713,6 +713,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     }
 
     public synchronized void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception {
+        if (routeDefinitions == null || routeDefinitions.isEmpty()) {
+            return;
+        }
         for (RouteDefinition routeDefinition : routeDefinitions) {
             removeRouteDefinition(routeDefinition);
         }
@@ -1416,22 +1419,26 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     }
 
     public void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception {
+        if (restDefinitions == null || restDefinitions.isEmpty()) {
+            return;
+        }
+
         this.restDefinitions.addAll(restDefinitions);
 
         // convert rests into routes so we reuse routes for runtime
         List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
         for (RestDefinition rest : restDefinitions) {
-            routes.addAll(rest.asRouteDefinition(this, restConfigurationDefinition));
+            routes.addAll(rest.asRouteDefinition(this));
         }
         addRouteDefinitions(routes);
     }
 
-    public RestConfigurationDefinition getRestConfigurationDefinition() {
-        return restConfigurationDefinition;
+    public RestConfiguration getRestConfiguration() {
+        return restConfiguration;
     }
 
-    public void setRestConfigurationDefinition(RestConfigurationDefinition restConfigurationDefinition) {
-        this.restConfigurationDefinition = restConfigurationDefinition;
+    public void setRestConfiguration(RestConfiguration restConfiguration) {
+        this.restConfiguration = restConfiguration;
     }
 
     public List<InterceptStrategy> getInterceptStrategies() {

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/model/ModelCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ModelCamelContext.java b/camel-core/src/main/java/org/apache/camel/model/ModelCamelContext.java
index 7682a28..912aa62 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ModelCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ModelCamelContext.java
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.model.rest.RestConfigurationDefinition;
 import org.apache.camel.model.rest.RestDefinition;
 
 /**
@@ -104,16 +103,6 @@ public interface ModelCamelContext extends CamelContext {
     List<RestDefinition> getRestDefinitions();
 
     /**
-     * Sets the REST configuration
-     */
-    void setRestConfigurationDefinition(RestConfigurationDefinition restConfigurationDefinition);
-
-    /**
-     * Returns the REST configuration
-     */
-    RestConfigurationDefinition getRestConfigurationDefinition();
-
-    /**
      * Adds a collection of rest definitions to the context
      *
      * @param restDefinitions the rest(s) definition to add

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java
index 2f1375a..0e8c170 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestConfigurationDefinition.java
@@ -21,6 +21,10 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.util.CamelContextHelper;
+
 /**
  * Represents an XML &lt;restConfiguration/&gt; element
  */
@@ -37,6 +41,11 @@ public class RestConfigurationDefinition {
     @XmlAttribute
     private String port;
 
+    // TODO: get properties to work with JAXB in the XSD model
+
+//    @XmlElementRef
+//    private List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>();
+
     public String getComponent() {
         return component;
     }
@@ -87,4 +96,46 @@ public class RestConfigurationDefinition {
         return this;
     }
 
+    public RestConfigurationDefinition property(String key, String value) {
+        /*PropertyDefinition prop = new PropertyDefinition();
+        prop.setKey(key);
+        prop.setValue(value);
+        getProperties().add(prop);*/
+        return this;
+    }
+
+    // Implementation
+    //-------------------------------------------------------------------------
+
+    /**
+     * Creates a {@link org.apache.camel.spi.RestConfiguration} instance based on the definition
+     *
+     * @param context     the camel context
+     * @return the configuration
+     * @throws Exception is thrown if error creating the configuration
+     */
+    public RestConfiguration asRestConfiguration(CamelContext context) throws Exception {
+        RestConfiguration answer = new RestConfiguration();
+        if (getComponent() != null) {
+            answer.setComponent(CamelContextHelper.parseText(context, getComponent()));
+        }
+        if (getHost() != null) {
+            answer.setHost(CamelContextHelper.parseText(context, getHost()));
+        }
+        if (getPort() != null) {
+            answer.setPort(CamelContextHelper.parseInteger(context, getPort()));
+        }
+        /*if (!properties.isEmpty()) {
+            Map<String, Object> props = new HashMap<String, Object>();
+            for (PropertyDefinition prop : properties) {
+                String key = prop.getKey();
+                String value = CamelContextHelper.parseText(context, prop.getValue());
+                props.put(key, value);
+            }
+            answer.setProperties(props);
+        }*/
+        return answer;
+
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 333ed00..9301ef9 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.model.ToDefinition;
 import org.apache.camel.util.FileUtil;
@@ -177,20 +176,16 @@ public class RestDefinition {
      * Camel routing engine can add and run. This allows us to define REST services using this
      * REST DSL and turn those into regular Camel routes.
      */
-    public List<RouteDefinition> asRouteDefinition(CamelContext camelContext, RestConfigurationDefinition configuration) throws Exception {
+    public List<RouteDefinition> asRouteDefinition(CamelContext camelContext) throws Exception {
         List<RouteDefinition> answer = new ArrayList<RouteDefinition>();
 
         for (VerbDefinition verb : getVerbs()) {
             String from = "rest:" + verb.asVerb() + ":" + buildUri(verb);
             // append options
             Map<String, Object> options = new HashMap<String, Object>();
-            if (configuration.getComponent() != null) {
-                options.put("componentName", configuration.getComponent());
-            }
             if (verb.getConsumes() != null) {
                 options.put("consumes", verb.getConsumes());
             }
-            // TODO: add more options here
             if (!options.isEmpty()) {
                 String query = URISupport.createQueryString(options);
                 from = from + "?" + query;

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/java/org/apache/camel/spi/RestConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/RestConfiguration.java b/camel-core/src/main/java/org/apache/camel/spi/RestConfiguration.java
new file mode 100644
index 0000000..ab796b2
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/spi/RestConfiguration.java
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spi;
+
+import java.util.Map;
+
+/**
+ * Configuration use by {@link org.apache.camel.spi.RestConsumerFactory} for Camel components to support
+ * the Camel {@link org.apache.camel.model.rest.RestDefinition rest} DSL.
+ */
+public class RestConfiguration {
+
+    private String component;
+    private String host;
+    private int port;
+    private Map<String, Object> properties;
+
+    /**
+     * Gets the name of the Camel component to use as the REST consumer
+     *
+     * @return the component name, or <tt>null</tt> to let Camel search the {@link Registry} to find suitable implementation
+     */
+    public String getComponent() {
+        return component;
+    }
+
+    /**
+     * Sets the name of the Camel component to use as the REST consumer
+     *
+     * @param componentName the name of the component (such as restlet, spark-rest, etc.)
+     */
+    public void setComponent(String componentName) {
+        this.component = componentName;
+    }
+
+    /**
+     * Gets the hostname to use by the REST consumer
+     *
+     * @return the hostname, or <tt>null</tt> to use default hostname
+     */
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * Sets the hostname to use by the REST consumer
+     *
+     * @param host the hostname
+     */
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    /**
+     * Gets the port to use by the REST consumer
+     *
+     * @return the port, or <tt>0</tt> or <tt>-1</tt> to use default port
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * Gets the port to use by the REST consumer
+     *
+     * @param port the port number
+     */
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Gets additional options to use to configure the REST consumer
+     *
+     * @return additional options
+     */
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+    /**
+     * Sets additional options to use to configure the REST consumer
+     *
+     * @param properties the options
+     */
+    public void setProperties(Map<String, Object> properties) {
+        this.properties = properties;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
----------------------------------------------------------------------
diff --git a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
index 7dfc3b8..1c50df5 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/rest/jaxb.index
@@ -14,8 +14,11 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ------------------------------------------------------------------------
+DeleteVerbDefinition
 GetVerbDefinition
+HeadVerbDefinition
 PostVerbDefinition
+PutVerbDefinition
 RestConfigurationDefinition
 RestDefinition
 RestsDefinition

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java
new file mode 100644
index 0000000..73992cc
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestConfigurationTest.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class FromRestConfigurationTest extends FromRestGetTest {
+
+    @Override
+    public void testFromRestModel() throws Exception {
+        super.testFromRestModel();
+
+        assertEquals("dummy-rest", context.getRestConfiguration().getComponent());
+        assertEquals("localhost", context.getRestConfiguration().getHost());
+        assertEquals(9090, context.getRestConfiguration().getPort());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                restConfiguration().component("dummy-rest").host("localhost").port(9090);
+
+                rest("/say/hello")
+                        .get().to("direct:hello");
+
+                rest("/say/bye")
+                        .get().consumes("application/json").to("direct:bye").endRest()
+                        .post().to("mock:update");
+
+                from("direct:hello")
+                    .transform().constant("Hello World");
+
+                from("direct:bye")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
index 313b61a..d40ef6f 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -637,7 +637,7 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
         return restConfiguration;
     }
 
-    public void setRestConfigurationDefinition(RestConfigurationDefinition restConfiguration) {
+    public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
         this.restConfiguration = restConfiguration;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-blueprint/src/test/java/org/apache/camel/blueprint/BlueprintJaxbRestTest.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/test/java/org/apache/camel/blueprint/BlueprintJaxbRestTest.java b/components/camel-blueprint/src/test/java/org/apache/camel/blueprint/BlueprintJaxbRestTest.java
index 6b2ffb2..00e4ae4 100644
--- a/components/camel-blueprint/src/test/java/org/apache/camel/blueprint/BlueprintJaxbRestTest.java
+++ b/components/camel-blueprint/src/test/java/org/apache/camel/blueprint/BlueprintJaxbRestTest.java
@@ -77,5 +77,9 @@ public class BlueprintJaxbRestTest extends TestSupport {
         assertEquals("get", cfb.getRests().get(0).getVerbs().get(0).asVerb());
         assertEquals("get", cfb.getRests().get(1).getVerbs().get(0).asVerb());
         assertEquals("post", cfb.getRests().get(1).getVerbs().get(1).asVerb());
+
+        assertEquals("dummy-rest", cfb.getRestConfiguration().getComponent());
+        assertEquals("localhost", cfb.getRestConfiguration().getHost());
+        assertEquals("9090", cfb.getRestConfiguration().getPort());
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-blueprint/src/test/resources/test-rest.xml
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/test/resources/test-rest.xml b/components/camel-blueprint/src/test/resources/test-rest.xml
index 50075fe..f2a4598 100644
--- a/components/camel-blueprint/src/test/resources/test-rest.xml
+++ b/components/camel-blueprint/src/test/resources/test-rest.xml
@@ -21,7 +21,7 @@
 
   <camelContext xmlns="http://camel.apache.org/schema/blueprint">
 
-    <restConfiguration component="dummy-rest"/>
+    <restConfiguration component="dummy-rest" host="localhost" port="9090"/>
 
     <rest uri="/say/hello">
       <get>

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
index b89485d..6d6b9ce 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -84,6 +84,7 @@ import org.apache.camel.spi.NodeIdFactory;
 import org.apache.camel.spi.PackageScanClassResolver;
 import org.apache.camel.spi.PackageScanFilter;
 import org.apache.camel.spi.ProcessorFactory;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RuntimeEndpointRegistry;
 import org.apache.camel.spi.ShutdownStrategy;
 import org.apache.camel.spi.StreamCachingStrategy;
@@ -687,7 +688,7 @@ public abstract class AbstractCamelContextFactoryBean<T extends ModelCamelContex
             ctx.setTypeConverterStatisticsEnabled(getTypeConverterStatisticsEnabled());
         }
         if (getRestConfiguration() != null) {
-            ctx.setRestConfigurationDefinition(getRestConfiguration());
+            ctx.setRestConfiguration(getRestConfiguration().asRestConfiguration(ctx));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index 0862dfb..176032c 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -27,9 +27,8 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.HeaderFilterStrategyComponent;
-import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RestConsumerFactory;
-import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.URISupport;
 import org.apache.camel.util.UnsafeUriCharactersEncoder;
@@ -476,18 +475,18 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R
 
         path = FileUtil.stripLeadingSeparator(path);
 
-        ModelCamelContext model = (ModelCamelContext) getCamelContext();
-
-        String host = "0.0.0.0";
         int port = 0;
-        if (model.getRestConfigurationDefinition() != null) {
-            String value = model.getRestConfigurationDefinition().getPort();
-            if (value != null) {
-                port = CamelContextHelper.parseInteger(model, value);
+        String host = "0.0.0.0";
+
+        // if no explicit port/host configured, then use port from rest configuration
+        RestConfiguration config = getCamelContext().getRestConfiguration();
+        if (config != null && (config.getComponent() == null || config.getComponent().equals("restlet"))) {
+            int num = config.getPort();
+            if (num > 0) {
+                port = num;
             }
-            value = model.getRestConfigurationDefinition().getHost();
-            if (value != null) {
-                host = CamelContextHelper.parseText(model, value);
+            if (config.getHost() != null) {
+                host = config.getHost();
             }
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java
index d055ce0..c14e3fe 100644
--- a/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java
+++ b/components/camel-spark-rest/src/main/java/org/apache/camel/component/sparkrest/SparkComponent.java
@@ -25,6 +25,7 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RestConsumerFactory;
 import org.apache.camel.util.ObjectHelper;
 import spark.Spark;
@@ -92,6 +93,15 @@ public class SparkComponent extends UriEndpointComponent implements RestConsumer
 
         if (getPort() != SparkBase.SPARK_DEFAULT_PORT) {
             Spark.setPort(getPort());
+        } else {
+            // if no explicit port configured, then use port from rest configuration
+            RestConfiguration config = getCamelContext().getRestConfiguration();
+            if (config != null && (config.getComponent() == null || config.getComponent().equals("spark-rest"))) {
+                int port = config.getPort();
+                if (port > 0) {
+                    Spark.setPort(port);
+                }
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
new file mode 100644
index 0000000..b6811af
--- /dev/null
+++ b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.sparkrest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class RestConfigurationCamelSparkTest extends CamelTestSupport {
+
+    private int port;
+
+    @Test
+    public void testSparkHello() throws Exception {
+        String out = template.requestBody("http://0.0.0.0:" + port + "/spark/hello", null, String.class);
+        assertEquals("Hello World", out);
+    }
+
+    @Test
+    public void testSparkBye() throws Exception {
+        String out = template.requestBody("http://0.0.0.0:" + port + "/spark/bye", null, String.class);
+        assertEquals("Bye World", out);
+    }
+
+    @Test
+    public void testSparkPost() throws Exception {
+        getMockEndpoint("mock:update").expectedBodiesReceived("I did this");
+
+        template.requestBody("http://0.0.0.0:" + port + "/spark/bye", "I did this", String.class);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                port = AvailablePortFinder.getNextAvailable(24500);
+
+                // configure port on rest configuration which spark-rest will pickup and use
+                restConfiguration().component("spark-rest").port(port);
+
+                // will automatic find the spark component to use, as we setup that component in the BaseSparkTest
+                rest("/spark/hello")
+                    .get().to("direct:hello");
+
+                rest("/spark/bye")
+                    .get().to("direct:bye")
+                    .post().to("mock:update");
+
+                from("direct:hello")
+                    .transform().constant("Hello World");
+
+                from("direct:bye")
+                    .transform().constant("Bye World");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index e436dbb..478c4f1 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -410,7 +410,7 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
         return restConfiguration;
     }
 
-    public void setRestConfigurationDefinition(RestConfigurationDefinition restConfiguration) {
+    public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
         this.restConfiguration = restConfiguration;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
index 66efd34..1c256bd 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
@@ -313,6 +313,7 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport {
                 CamelContextFactoryBean factoryBean = (CamelContextFactoryBean) value;
                 builder.addPropertyValue("id", contextId);
                 builder.addPropertyValue("implicitId", implicitId);
+                builder.addPropertyValue("restConfiguration", factoryBean.getRestConfiguration());
                 builder.addPropertyValue("rests", factoryBean.getRests());
                 builder.addPropertyValue("routes", factoryBean.getRoutes());
                 builder.addPropertyValue("intercepts", factoryBean.getIntercepts());

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-spring/src/test/java/org/apache/camel/component/rest/SpringFromRestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/rest/SpringFromRestConfigurationTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/rest/SpringFromRestConfigurationTest.java
new file mode 100644
index 0000000..4139633
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/rest/SpringFromRestConfigurationTest.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.rest;
+
+import org.apache.camel.CamelContext;
+
+import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringFromRestConfigurationTest extends FromRestConfigurationTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
new file mode 100644
index 0000000..79c84e5
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestConfigurationTest.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- use a dummy rest consumer factory for the rest engine -->
+  <bean id="dummy-rest" class="org.apache.camel.component.rest.DummyRestConsumerFactory"/>
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+
+    <restConfiguration component="dummy-rest" host="localhost" port="9090"/>
+
+    <rest uri="/say/hello">
+      <get>
+        <to uri="direct:hello"/>
+      </get>
+    </rest>
+    <rest uri="/say/bye">
+      <get consumes="application/json">
+        <to uri="direct:bye"/>
+      </get>
+      <post>
+        <to uri="mock:update"/>
+      </post>
+    </rest>
+
+    <route>
+      <from uri="direct:hello"/>
+      <transform>
+        <constant>Hello World</constant>
+      </transform>
+    </route>
+    <route>
+      <from uri="direct:bye"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+    </route>
+
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.java
new file mode 100644
index 0000000..b2e6f91
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint.component.rest;
+
+import org.junit.Test;
+
+public class FromRestConfigurationTest extends FromRestGetTest {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml";
+    }
+
+    @Test
+    public void testFromRestModel() throws Exception {
+        super.testFromRestModel();
+
+        assertEquals("dummy-rest", context.getRestConfiguration().getComponent());
+        assertEquals("localhost", context.getRestConfiguration().getHost());
+        assertEquals(9090, context.getRestConfiguration().getPort());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2f856a6b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
new file mode 100644
index 0000000..9fa70e0
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestConfigurationTest.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- use a dummy rest consumer factory for the rest engine -->
+  <bean id="dummy-rest" class="org.apache.camel.test.blueprint.component.rest.DummyRestConsumerFactory"/>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+    <restConfiguration component="dummy-rest" host="localhost" port="9090"/>
+
+    <rest uri="/say/hello">
+      <get>
+        <to uri="direct:hello"/>
+      </get>
+    </rest>
+    <rest uri="/say/bye">
+      <get consumes="application/json">
+        <to uri="direct:bye"/>
+      </get>
+      <post>
+        <to uri="mock:update"/>
+      </post>
+    </rest>
+
+    <route>
+      <from uri="direct:hello"/>
+      <transform>
+        <constant>Hello World</constant>
+      </transform>
+    </route>
+    <route>
+      <from uri="direct:bye"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+    </route>
+
+  </camelContext>
+
+</blueprint>
\ No newline at end of file


Mime
View raw message