Repository: camel
Updated Branches:
  refs/heads/camel-2.19.x 008391155 -> 507916f52
  refs/heads/master ffcad28f3 -> a5981622f


CAMEL-11636: rest-dsl should also use property placeholders on the verb and its 
params.


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

Branch: refs/heads/master
Commit: a5981622f7584cc4957d1bd6393d19ff85e0e5f1
Parents: ffcad28
Author: Claus Ibsen <davscl...@apache.org>
Authored: Mon Aug 7 09:39:20 2017 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Mon Aug 7 09:39:20 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/model/rest/RestDefinition.java    | 11 +++++++++++
 .../src/main/resources/camel-config-xml.xml        |  6 +++++-
 .../src/main/resources/rest.properties             | 17 +++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a5981622/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 b668f48..fa024ae 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
@@ -32,6 +32,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 import org.apache.camel.CamelContext;
 import org.apache.camel.model.OptionalIdentifiedDefinition;
 import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.model.ProcessorDefinitionHelper;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.model.ToDefinition;
 import org.apache.camel.model.ToDynamicDefinition;
@@ -723,6 +724,16 @@ public class RestDefinition extends 
OptionalIdentifiedDefinition<RestDefinition>
                 route.getOutputs().add(def);
             }
 
+            // ensure property placeholders is resolved on the verb
+            try {
+                
ProcessorDefinitionHelper.resolvePropertyPlaceholders(camelContext, verb);
+                for (RestOperationParamDefinition param : verb.getParams()) {
+                    
ProcessorDefinitionHelper.resolvePropertyPlaceholders(camelContext, param);
+                }
+            } catch (Exception e) {
+                throw ObjectHelper.wrapRuntimeCamelException(e);
+            }
+
             // add the binding
             RestBindingDefinition binding = new RestBindingDefinition();
             binding.setComponent(component);

http://git-wip-us.apache.org/repos/asf/camel/blob/a5981622/examples/camel-example-swagger-xml/src/main/resources/camel-config-xml.xml
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-swagger-xml/src/main/resources/camel-config-xml.xml 
b/examples/camel-example-swagger-xml/src/main/resources/camel-config-xml.xml
index 9c78d2e..079a4cc 100755
--- a/examples/camel-example-swagger-xml/src/main/resources/camel-config-xml.xml
+++ b/examples/camel-example-swagger-xml/src/main/resources/camel-config-xml.xml
@@ -29,6 +29,9 @@
 
   <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring";>
 
+    <!-- property placeholder file -->
+    <propertyPlaceholder id="properties" location="rest.properties"/>
+
     <!-- configure rest to use the camel-servlet component, and use json 
binding mode -->
     <!-- and tell to output json in pretty print mode -->
     <!-- setup context path and port number that Apache Tomcat will deploy 
this application with,
@@ -97,9 +100,10 @@
 
       <get uri="/ping">
         <description>A ping service</description>
+        <param name="name" type="query" description="You can provide a name" 
dataType="string" defaultValue="{{defaultName}}"/>
         <route>
           <transform>
-            <constant>pong</constant>
+            <simple>pong ${header.name}</simple>
           </transform>
         </route>
       </get>

http://git-wip-us.apache.org/repos/asf/camel/blob/a5981622/examples/camel-example-swagger-xml/src/main/resources/rest.properties
----------------------------------------------------------------------
diff --git 
a/examples/camel-example-swagger-xml/src/main/resources/rest.properties 
b/examples/camel-example-swagger-xml/src/main/resources/rest.properties
new file mode 100644
index 0000000..43052e1
--- /dev/null
+++ b/examples/camel-example-swagger-xml/src/main/resources/rest.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+defaultName=Camel
\ No newline at end of file

Reply via email to