You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/07/25 18:53:40 UTC

[1/4] camel git commit: Fixed camel-swagger-java to use correct HTTP accept header to detect what the client want as response.

Repository: camel
Updated Branches:
  refs/heads/camel-2.19.x eed0e8ace -> e0e6beebf
  refs/heads/master c88d02107 -> 0e5dcd2a7


Fixed camel-swagger-java to use correct HTTP accept header to detect what the client want as response.


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

Branch: refs/heads/master
Commit: 0e5dcd2a769dd453f75ce618c8a774dfc28531a2
Parents: 8e412cd
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 25 20:46:11 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 25 20:47:27 2017 +0200

----------------------------------------------------------------------
 camel-core/src/main/java/org/apache/camel/Exchange.java       | 1 +
 .../java/org/apache/camel/swagger/RestSwaggerProcessor.java   | 7 ++++---
 .../org/apache/camel/swagger/servlet/RestSwaggerServlet.java  | 7 ++++---
 examples/camel-example-swagger-cdi/README.md                  | 6 +++---
 4 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0e5dcd2a/camel-core/src/main/java/org/apache/camel/Exchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java
index bfe9251..6110201 100644
--- a/camel-core/src/main/java/org/apache/camel/Exchange.java
+++ b/camel-core/src/main/java/org/apache/camel/Exchange.java
@@ -73,6 +73,7 @@ public interface Exchange {
 
     String AUTHENTICATION                   = "CamelAuthentication";
     String AUTHENTICATION_FAILURE_POLICY_ID = "CamelAuthenticationFailurePolicyId";
+    @Deprecated
     String ACCEPT_CONTENT_TYPE              = "CamelAcceptContentType";
     String AGGREGATED_SIZE                  = "CamelAggregatedSize";
     String AGGREGATED_TIMEOUT               = "CamelAggregatedTimeout";

http://git-wip-us.apache.org/repos/asf/camel/blob/0e5dcd2a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
index 9edf41e..229b5bc 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
@@ -17,6 +17,7 @@
 package org.apache.camel.swagger;
 
 import java.util.Collections;
+import java.util.Locale;
 import java.util.Map;
 
 import io.swagger.jaxrs.config.BeanConfig;
@@ -56,7 +57,7 @@ public class RestSwaggerProcessor implements Processor {
 
         String contextId = exchange.getContext().getName();
         String route = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
-        String accept = exchange.getIn().getHeader(Exchange.ACCEPT_CONTENT_TYPE, String.class);
+        String accept = exchange.getIn().getHeader("Accept", String.class);
 
         RestApiResponseAdapter adapter = new ExchangeRestApiResponseAdapter(exchange);
 
@@ -71,8 +72,8 @@ public class RestSwaggerProcessor implements Processor {
             route = route.substring(0, route.length() - 13);
         }
         if (accept != null && !json && !yaml) {
-            json = accept.contains("json");
-            yaml = accept.contains("yaml");
+            json = accept.toLowerCase(Locale.US).contains("json");
+            yaml = accept.toLowerCase(Locale.US).contains("yaml");
         }
         if (!json && !yaml) {
             // json is default

http://git-wip-us.apache.org/repos/asf/camel/blob/0e5dcd2a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
----------------------------------------------------------------------
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
index 3aa7a75..6d47826 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
@@ -22,6 +22,7 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -122,7 +123,7 @@ public class RestSwaggerServlet extends HttpServlet {
 
         String contextId = null;
         String route = request.getPathInfo();
-        String accept = request.getHeader(Exchange.ACCEPT_CONTENT_TYPE);
+        String accept = request.getHeader("Accept");
 
         // whether to use json or yaml
         boolean json = false;
@@ -135,8 +136,8 @@ public class RestSwaggerServlet extends HttpServlet {
             route = route.substring(0, route.length() - 13);
         }
         if (accept != null && !json && !yaml) {
-            json = accept.contains("json");
-            yaml = accept.contains("yaml");
+            json = accept.toLowerCase(Locale.US).contains("json");
+            yaml = accept.toLowerCase(Locale.US).contains("yaml");
         }
         if (!json && !yaml) {
             // json is default

http://git-wip-us.apache.org/repos/asf/camel/blob/0e5dcd2a/examples/camel-example-swagger-cdi/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-swagger-cdi/README.md b/examples/camel-example-swagger-cdi/README.md
index aa9a0bb..3985367 100644
--- a/examples/camel-example-swagger-cdi/README.md
+++ b/examples/camel-example-swagger-cdi/README.md
@@ -32,11 +32,11 @@ For example to get a user with id 123
 The rest services provides Swagger API in json or yaml format
 which can be accessed from the following url
 
-    curl http://localhost:8080/api-doc/swagger.json
-    curl http://localhost:8080/api-doc/swagger.yaml
+    curl -H "Accept: application/json" http://localhost:8080/api-doc
+    curl -H "Accept: application/yaml" http://localhost:8080/api-doc
 
 
-<http://localhost:8080/api-doc/swagger.json>
+<http://localhost:8080/api-doc>
 
 To stop the example hit <kbd>ctrl</kbd>+<kbd>c</kbd>
 


[2/4] camel git commit: CAMEL-11593: Global rest configuration gets overridden by default

Posted by da...@apache.org.
CAMEL-11593: Global rest configuration gets overridden by default


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

Branch: refs/heads/master
Commit: 8e412cd07ce2a133415ae93cb204c6fd1b6f2c7f
Parents: c88d021
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 25 16:26:48 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 25 20:47:27 2017 +0200

----------------------------------------------------------------------
 .../camel/component/rest/RestComponent.java     |  9 ++--
 .../apache/camel/impl/DefaultCamelContext.java  | 10 ++--
 .../apache/camel/model/rest/RestDefinition.java | 13 ++++-
 .../spring/boot/CamelAutoConfiguration.java     |  7 +++
 .../springboot/geocoder/Application.java        |  9 +---
 .../springboot/geocoder/CamelGeocoderRoute.java | 47 +++++++++++++++++
 .../springboot/geocoder/CamelRouter.java        | 55 --------------------
 .../src/main/resources/application.properties   | 36 +++++++++++++
 8 files changed, 113 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/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 d1c1963..264750c 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
@@ -64,7 +64,7 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
 
         // if no explicit host was given, then fallback and use default configured host
         String h = getAndRemoveOrResolveReferenceParameter(parameters, "host", String.class, host);
-        if (h == null && config != null) {
+        if (h == null) {
             h = config.getHost();
             int port = config.getPort();
             // is there a custom port number
@@ -118,7 +118,7 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
         answer.setUriTemplate(uriTemplate);
 
         // if no explicit component name was given, then fallback and use default configured component name
-        if (answer.getComponentName() == null && config != null) {
+        if (answer.getComponentName() == null) {
             String name = config.getProducerComponent();
             if (name == null) {
                 // fallback and use the consumer name
@@ -127,7 +127,7 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
             answer.setComponentName(name);
         }
         // if no explicit producer api was given, then fallback and use default configured
-        if (answer.getApiDoc() == null && config != null) {
+        if (answer.getApiDoc() == null) {
             answer.setApiDoc(config.getProducerApiDoc());
         }
 
@@ -188,6 +188,9 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
     }
 
     private RestConfiguration mergeConfigurations(RestConfiguration conf, RestConfiguration from) throws Exception {
+        if (conf == from) {
+            return conf;
+        }
         if (from != null) {
             Map<String, Object> map = IntrospectionSupport.getNonNullProperties(from);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/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 061263a..b46b6c2 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
@@ -2733,12 +2733,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     }
 
     public RestConfiguration getRestConfiguration() {
-        RestConfiguration config = restConfigurations.get("");
-        if (config == null) {
-            config = new RestConfiguration();
-            setRestConfiguration(config);
-        }
-        return config;
+        return restConfigurations.get("");
     }
 
     public void setRestConfiguration(RestConfiguration restConfiguration) {
@@ -2759,8 +2754,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
         }
         RestConfiguration config = restConfigurations.get(component);
         if (config == null && defaultIfNotExist) {
+            // grab the default configuration
             config = getRestConfiguration();
-            if (config != null && config.getComponent() != null && !config.getComponent().equals(component)) {
+            if (config == null || (config.getComponent() != null && !config.getComponent().equals(component))) {
                 config = new RestConfiguration();
                 restConfigurations.put(component, config);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/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 6973f8c..b668f48 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
@@ -37,6 +37,7 @@ import org.apache.camel.model.ToDefinition;
 import org.apache.camel.model.ToDynamicDefinition;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.URISupport;
@@ -615,7 +616,17 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
         List<RouteDefinition> answer = new ArrayList<RouteDefinition>();
         if (camelContext.getRestConfigurations().isEmpty()) {
-            camelContext.getRestConfiguration();
+            // make sure to initialize a rest configuration when its empty
+            // lookup a global which may have been setup via camel-spring-boot etc
+            RestConfiguration conf = CamelContextHelper.lookup(camelContext, RestConstants.DEFAULT_REST_CONFIGURATION_ID, RestConfiguration.class);
+            if (conf == null) {
+                conf = CamelContextHelper.findByType(camelContext, RestConfiguration.class);
+            }
+            if (conf != null) {
+                camelContext.setRestConfiguration(conf);
+            } else {
+                camelContext.setRestConfiguration(new RestConfiguration());
+            }
         }
         for (RestConfiguration config : camelContext.getRestConfigurations()) {
             addRouteDefinition(camelContext, answer, config.getComponent());

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index 6605029..7363704 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -46,6 +46,7 @@ import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.ManagementNamingStrategy;
 import org.apache.camel.spi.ManagementStrategy;
 import org.apache.camel.spi.ReloadStrategy;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RouteController;
 import org.apache.camel.spi.RoutePolicyFactory;
 import org.apache.camel.spi.RuntimeEndpointRegistry;
@@ -447,6 +448,12 @@ public class CamelAutoConfiguration {
             camelContext.setRouteController(routeController);
         }
 
+        // rest-dsl global configuration
+        RestConfiguration restConfiguration = getSingleBeanOfType(applicationContext, RestConfiguration.class);
+        if (restConfiguration != null) {
+            camelContext.setRestConfiguration(restConfiguration);
+        }
+
         // set the default thread pool profile if defined
         initThreadPoolProfiles(applicationContext, camelContext);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
index 25f5f1f..c4735ff 100644
--- a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
+++ b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
@@ -19,16 +19,10 @@ package org.apache.camel.example.springboot.geocoder;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+// CHECKSTYLE:OFF
 @SpringBootApplication
 public class Application {
 
-    /*
-     * For  PMD HideUtilityClassConstructorCheck
-     */
-    private void noop() {
-
-    }
-
     /**
      * Main method to start the application.
      */
@@ -37,3 +31,4 @@ public class Application {
     }
 
 }
+// CHECKSTYLE:ON

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java
new file mode 100644
index 0000000..4ea6e93
--- /dev/null
+++ b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java
@@ -0,0 +1,47 @@
+/**
+ * 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.example.springboot.geocoder;
+
+import com.google.code.geocoder.model.GeocodeResponse;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.springframework.stereotype.Component;
+
+import static org.apache.camel.model.rest.RestParamType.query;
+
+/**
+ * A simple Camel REST DSL route example using the Geocoder component and documented with Swagger
+ */
+@Component
+public class CamelGeocoderRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        // rest-dsl is also configured in the application.properties file
+
+        rest("/geocoder").description("Geocoder REST service")
+            .consumes("application/json")
+            .produces("application/json")
+
+            .get().description("Geocoder address lookup").outType(GeocodeResponse.class)
+                .param().name("address").type(query).description("The address to lookup").dataType("string").endParam()
+                .responseMessage().code(200).message("Geocoder successful").endResponseMessage()
+                // call the geocoder to lookup details from the provided address
+                .toD("geocoder:address:${header.address}");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java
deleted file mode 100644
index 3f0183a..0000000
--- a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.example.springboot.geocoder;
-
-import com.google.code.geocoder.model.GeocodeResponse;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.RestBindingMode;
-import org.springframework.stereotype.Component;
-
-import static org.apache.camel.model.rest.RestParamType.query;
-
-/**
- * A simple Camel REST DSL route example using the Geocoder component and documented with Swagger
- * 
- */
-@Component
-public class CamelRouter extends RouteBuilder {
-
-    @Override
-    public void configure() throws Exception {
-        restConfiguration()
-            .component("servlet")
-            .bindingMode(RestBindingMode.json)
-            .dataFormatProperty("prettyPrint", "true")
-            .apiContextPath("/api-doc")
-                .apiProperty("api.title", "Geocoder API").apiProperty("api.version", "1.0.0")
-                .apiProperty("cors", "true");
-
-
-        rest("/geocoder").description("Geocoder REST service")
-                .consumes("application/json")
-                .produces("application/json")
-
-                .get().description("Geocoder address lookup").outType(GeocodeResponse.class)
-                .param().name("address").type(query).description("The address to lookup").dataType("string").endParam()
-                .responseMessage().code(200).message("Geocoder successful").endResponseMessage()
-                .toD("geocoder:address:${header.address}");
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/8e412cd0/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties b/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties
new file mode 100644
index 0000000..221789b
--- /dev/null
+++ b/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties
@@ -0,0 +1,36 @@
+## ---------------------------------------------------------------------------
+## 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.
+
+camel.springboot.name=Geocoder
+
+# use servlet as the component
+# (this can be omitted as camel will lookup on the classpath and discover it automatic)
+camel.rest.component=servlet
+
+# turn on json binding
+camel.rest.binding-mode=json
+
+# output in pretty print mode
+camel.rest.data-format-property.prettyPrint=true
+
+# context path for swagger api docs
+camel.rest.api-context-path=/api-doc
+
+# swagger api properties
+camel.rest.api-property.api.title=Geocoder API
+camel.rest.api-property.api.version=1.0.0
+camel.rest.api-property.cors=true
+


[4/4] camel git commit: Fixed camel-swagger-java to use correct HTTP accept header to detect what the client want as response.

Posted by da...@apache.org.
Fixed camel-swagger-java to use correct HTTP accept header to detect what the client want as response.


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

Branch: refs/heads/camel-2.19.x
Commit: e0e6beebfa4977959cf8527532d329678632f458
Parents: 26d70e7
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 25 20:46:11 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 25 20:50:40 2017 +0200

----------------------------------------------------------------------
 camel-core/src/main/java/org/apache/camel/Exchange.java       | 1 +
 .../java/org/apache/camel/swagger/RestSwaggerProcessor.java   | 7 ++++---
 .../org/apache/camel/swagger/servlet/RestSwaggerServlet.java  | 7 ++++---
 examples/camel-example-swagger-cdi/README.md                  | 6 +++---
 4 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e0e6beeb/camel-core/src/main/java/org/apache/camel/Exchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java
index eecc7e0..4f09708 100644
--- a/camel-core/src/main/java/org/apache/camel/Exchange.java
+++ b/camel-core/src/main/java/org/apache/camel/Exchange.java
@@ -72,6 +72,7 @@ public interface Exchange {
 
     String AUTHENTICATION                   = "CamelAuthentication";
     String AUTHENTICATION_FAILURE_POLICY_ID = "CamelAuthenticationFailurePolicyId";
+    @Deprecated
     String ACCEPT_CONTENT_TYPE              = "CamelAcceptContentType";
     String AGGREGATED_SIZE                  = "CamelAggregatedSize";
     String AGGREGATED_TIMEOUT               = "CamelAggregatedTimeout";

http://git-wip-us.apache.org/repos/asf/camel/blob/e0e6beeb/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
index 9edf41e..229b5bc 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/RestSwaggerProcessor.java
@@ -17,6 +17,7 @@
 package org.apache.camel.swagger;
 
 import java.util.Collections;
+import java.util.Locale;
 import java.util.Map;
 
 import io.swagger.jaxrs.config.BeanConfig;
@@ -56,7 +57,7 @@ public class RestSwaggerProcessor implements Processor {
 
         String contextId = exchange.getContext().getName();
         String route = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
-        String accept = exchange.getIn().getHeader(Exchange.ACCEPT_CONTENT_TYPE, String.class);
+        String accept = exchange.getIn().getHeader("Accept", String.class);
 
         RestApiResponseAdapter adapter = new ExchangeRestApiResponseAdapter(exchange);
 
@@ -71,8 +72,8 @@ public class RestSwaggerProcessor implements Processor {
             route = route.substring(0, route.length() - 13);
         }
         if (accept != null && !json && !yaml) {
-            json = accept.contains("json");
-            yaml = accept.contains("yaml");
+            json = accept.toLowerCase(Locale.US).contains("json");
+            yaml = accept.toLowerCase(Locale.US).contains("yaml");
         }
         if (!json && !yaml) {
             // json is default

http://git-wip-us.apache.org/repos/asf/camel/blob/e0e6beeb/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
----------------------------------------------------------------------
diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
index 3aa7a75..6d47826 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
@@ -22,6 +22,7 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -122,7 +123,7 @@ public class RestSwaggerServlet extends HttpServlet {
 
         String contextId = null;
         String route = request.getPathInfo();
-        String accept = request.getHeader(Exchange.ACCEPT_CONTENT_TYPE);
+        String accept = request.getHeader("Accept");
 
         // whether to use json or yaml
         boolean json = false;
@@ -135,8 +136,8 @@ public class RestSwaggerServlet extends HttpServlet {
             route = route.substring(0, route.length() - 13);
         }
         if (accept != null && !json && !yaml) {
-            json = accept.contains("json");
-            yaml = accept.contains("yaml");
+            json = accept.toLowerCase(Locale.US).contains("json");
+            yaml = accept.toLowerCase(Locale.US).contains("yaml");
         }
         if (!json && !yaml) {
             // json is default

http://git-wip-us.apache.org/repos/asf/camel/blob/e0e6beeb/examples/camel-example-swagger-cdi/README.md
----------------------------------------------------------------------
diff --git a/examples/camel-example-swagger-cdi/README.md b/examples/camel-example-swagger-cdi/README.md
index aa9a0bb..3985367 100644
--- a/examples/camel-example-swagger-cdi/README.md
+++ b/examples/camel-example-swagger-cdi/README.md
@@ -32,11 +32,11 @@ For example to get a user with id 123
 The rest services provides Swagger API in json or yaml format
 which can be accessed from the following url
 
-    curl http://localhost:8080/api-doc/swagger.json
-    curl http://localhost:8080/api-doc/swagger.yaml
+    curl -H "Accept: application/json" http://localhost:8080/api-doc
+    curl -H "Accept: application/yaml" http://localhost:8080/api-doc
 
 
-<http://localhost:8080/api-doc/swagger.json>
+<http://localhost:8080/api-doc>
 
 To stop the example hit <kbd>ctrl</kbd>+<kbd>c</kbd>
 


[3/4] camel git commit: CAMEL-11593: Global rest configuration gets overridden by default

Posted by da...@apache.org.
CAMEL-11593: Global rest configuration gets overridden by default


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

Branch: refs/heads/camel-2.19.x
Commit: 26d70e72ffd434ebe5ed9f425868e352f83689f3
Parents: eed0e8a
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 25 16:26:48 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jul 25 20:50:00 2017 +0200

----------------------------------------------------------------------
 .../camel/component/rest/RestComponent.java     |  9 ++--
 .../apache/camel/impl/DefaultCamelContext.java  | 10 ++--
 .../apache/camel/model/rest/RestDefinition.java | 13 ++++-
 .../spring/boot/CamelAutoConfiguration.java     |  7 +++
 .../springboot/geocoder/Application.java        |  9 +---
 .../springboot/geocoder/CamelGeocoderRoute.java | 47 +++++++++++++++++
 .../springboot/geocoder/CamelRouter.java        | 55 --------------------
 .../src/main/resources/application.properties   | 36 +++++++++++++
 8 files changed, 113 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/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 d1c1963..264750c 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
@@ -64,7 +64,7 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
 
         // if no explicit host was given, then fallback and use default configured host
         String h = getAndRemoveOrResolveReferenceParameter(parameters, "host", String.class, host);
-        if (h == null && config != null) {
+        if (h == null) {
             h = config.getHost();
             int port = config.getPort();
             // is there a custom port number
@@ -118,7 +118,7 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
         answer.setUriTemplate(uriTemplate);
 
         // if no explicit component name was given, then fallback and use default configured component name
-        if (answer.getComponentName() == null && config != null) {
+        if (answer.getComponentName() == null) {
             String name = config.getProducerComponent();
             if (name == null) {
                 // fallback and use the consumer name
@@ -127,7 +127,7 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
             answer.setComponentName(name);
         }
         // if no explicit producer api was given, then fallback and use default configured
-        if (answer.getApiDoc() == null && config != null) {
+        if (answer.getApiDoc() == null) {
             answer.setApiDoc(config.getProducerApiDoc());
         }
 
@@ -188,6 +188,9 @@ public class RestComponent extends DefaultComponent implements VerifiableCompone
     }
 
     private RestConfiguration mergeConfigurations(RestConfiguration conf, RestConfiguration from) throws Exception {
+        if (conf == from) {
+            return conf;
+        }
         if (from != null) {
             Map<String, Object> map = IntrospectionSupport.getNonNullProperties(from);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/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 13cf55b..5a15441 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
@@ -2607,12 +2607,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     }
 
     public RestConfiguration getRestConfiguration() {
-        RestConfiguration config = restConfigurations.get("");
-        if (config == null) {
-            config = new RestConfiguration();
-            setRestConfiguration(config);
-        }
-        return config;
+        return restConfigurations.get("");
     }
 
     public void setRestConfiguration(RestConfiguration restConfiguration) {
@@ -2633,8 +2628,9 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
         }
         RestConfiguration config = restConfigurations.get(component);
         if (config == null && defaultIfNotExist) {
+            // grab the default configuration
             config = getRestConfiguration();
-            if (config != null && config.getComponent() != null && !config.getComponent().equals(component)) {
+            if (config == null || (config.getComponent() != null && !config.getComponent().equals(component))) {
                 config = new RestConfiguration();
                 restConfigurations.put(component, config);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/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 6973f8c..b668f48 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
@@ -37,6 +37,7 @@ import org.apache.camel.model.ToDefinition;
 import org.apache.camel.model.ToDynamicDefinition;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.RestConfiguration;
+import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.URISupport;
@@ -615,7 +616,17 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
         List<RouteDefinition> answer = new ArrayList<RouteDefinition>();
         if (camelContext.getRestConfigurations().isEmpty()) {
-            camelContext.getRestConfiguration();
+            // make sure to initialize a rest configuration when its empty
+            // lookup a global which may have been setup via camel-spring-boot etc
+            RestConfiguration conf = CamelContextHelper.lookup(camelContext, RestConstants.DEFAULT_REST_CONFIGURATION_ID, RestConfiguration.class);
+            if (conf == null) {
+                conf = CamelContextHelper.findByType(camelContext, RestConfiguration.class);
+            }
+            if (conf != null) {
+                camelContext.setRestConfiguration(conf);
+            } else {
+                camelContext.setRestConfiguration(new RestConfiguration());
+            }
         }
         for (RestConfiguration config : camelContext.getRestConfigurations()) {
             addRouteDefinition(camelContext, answer, config.getComponent());

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index c46e758..8eac55d 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -45,6 +45,7 @@ import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.ManagementNamingStrategy;
 import org.apache.camel.spi.ManagementStrategy;
 import org.apache.camel.spi.ReloadStrategy;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.spi.RoutePolicyFactory;
 import org.apache.camel.spi.RuntimeEndpointRegistry;
 import org.apache.camel.spi.ShutdownStrategy;
@@ -409,6 +410,12 @@ public class CamelAutoConfiguration {
             camelContext.setSSLContextParameters(sslContextParametersSupplier.get());
         }
 
+        // rest-dsl global configuration
+        RestConfiguration restConfiguration = getSingleBeanOfType(applicationContext, RestConfiguration.class);
+        if (restConfiguration != null) {
+            camelContext.setRestConfiguration(restConfiguration);
+        }
+
         // set the default thread pool profile if defined
         initThreadPoolProfiles(applicationContext, camelContext);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
index 25f5f1f..c4735ff 100644
--- a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
+++ b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/Application.java
@@ -19,16 +19,10 @@ package org.apache.camel.example.springboot.geocoder;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
+// CHECKSTYLE:OFF
 @SpringBootApplication
 public class Application {
 
-    /*
-     * For  PMD HideUtilityClassConstructorCheck
-     */
-    private void noop() {
-
-    }
-
     /**
      * Main method to start the application.
      */
@@ -37,3 +31,4 @@ public class Application {
     }
 
 }
+// CHECKSTYLE:ON

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java
new file mode 100644
index 0000000..4ea6e93
--- /dev/null
+++ b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelGeocoderRoute.java
@@ -0,0 +1,47 @@
+/**
+ * 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.example.springboot.geocoder;
+
+import com.google.code.geocoder.model.GeocodeResponse;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.springframework.stereotype.Component;
+
+import static org.apache.camel.model.rest.RestParamType.query;
+
+/**
+ * A simple Camel REST DSL route example using the Geocoder component and documented with Swagger
+ */
+@Component
+public class CamelGeocoderRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        // rest-dsl is also configured in the application.properties file
+
+        rest("/geocoder").description("Geocoder REST service")
+            .consumes("application/json")
+            .produces("application/json")
+
+            .get().description("Geocoder address lookup").outType(GeocodeResponse.class)
+                .param().name("address").type(query).description("The address to lookup").dataType("string").endParam()
+                .responseMessage().code(200).message("Geocoder successful").endResponseMessage()
+                // call the geocoder to lookup details from the provided address
+                .toD("geocoder:address:${header.address}");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java b/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java
deleted file mode 100644
index 3f0183a..0000000
--- a/examples/camel-example-spring-boot-geocoder/src/main/java/org/apache/camel/example/springboot/geocoder/CamelRouter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.example.springboot.geocoder;
-
-import com.google.code.geocoder.model.GeocodeResponse;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.rest.RestBindingMode;
-import org.springframework.stereotype.Component;
-
-import static org.apache.camel.model.rest.RestParamType.query;
-
-/**
- * A simple Camel REST DSL route example using the Geocoder component and documented with Swagger
- * 
- */
-@Component
-public class CamelRouter extends RouteBuilder {
-
-    @Override
-    public void configure() throws Exception {
-        restConfiguration()
-            .component("servlet")
-            .bindingMode(RestBindingMode.json)
-            .dataFormatProperty("prettyPrint", "true")
-            .apiContextPath("/api-doc")
-                .apiProperty("api.title", "Geocoder API").apiProperty("api.version", "1.0.0")
-                .apiProperty("cors", "true");
-
-
-        rest("/geocoder").description("Geocoder REST service")
-                .consumes("application/json")
-                .produces("application/json")
-
-                .get().description("Geocoder address lookup").outType(GeocodeResponse.class)
-                .param().name("address").type(query).description("The address to lookup").dataType("string").endParam()
-                .responseMessage().code(200).message("Geocoder successful").endResponseMessage()
-                .toD("geocoder:address:${header.address}");
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/26d70e72/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties b/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties
new file mode 100644
index 0000000..221789b
--- /dev/null
+++ b/examples/camel-example-spring-boot-geocoder/src/main/resources/application.properties
@@ -0,0 +1,36 @@
+## ---------------------------------------------------------------------------
+## 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.
+
+camel.springboot.name=Geocoder
+
+# use servlet as the component
+# (this can be omitted as camel will lookup on the classpath and discover it automatic)
+camel.rest.component=servlet
+
+# turn on json binding
+camel.rest.binding-mode=json
+
+# output in pretty print mode
+camel.rest.data-format-property.prettyPrint=true
+
+# context path for swagger api docs
+camel.rest.api-context-path=/api-doc
+
+# swagger api properties
+camel.rest.api-property.api.title=Geocoder API
+camel.rest.api-property.api.version=1.0.0
+camel.rest.api-property.cors=true
+