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 2019/08/09 08:13:04 UTC
[camel] branch master updated (9ea5498 -> fce66e0)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from 9ea5498 Regen
new b83833c CAMEL-13792: Fixed issue with camel-rest-swagger and renaming http components and some flaws with settign up rest configuration
new fce66e0 Fixed example as swagger petstorre uses https now and http4 works OOTB where as undertow dont
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/camel/component/http4/HttpComponent.java | 4 ++--
.../camel/component/rest/swagger/RestSwaggerEndpoint.java | 9 +++++++--
.../component/rest/swagger/RestSwaggerEndpointTest.java | 14 +++++++-------
.../java/org/apache/camel/component/rest/RestEndpoint.java | 10 +++-------
examples/camel-example-rest-swagger/pom.xml | 2 +-
5 files changed, 20 insertions(+), 19 deletions(-)
[camel] 01/02: CAMEL-13792: Fixed issue with camel-rest-swagger and
renaming http components and some flaws with settign up rest configuration
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b83833c2344fd8219eac0b4a055d55434b53521c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 9 10:12:08 2019 +0200
CAMEL-13792: Fixed issue with camel-rest-swagger and renaming http components and some flaws with settign up rest configuration
---
.../org/apache/camel/component/http4/HttpComponent.java | 4 ++--
.../camel/component/rest/swagger/RestSwaggerEndpoint.java | 9 +++++++--
.../component/rest/swagger/RestSwaggerEndpointTest.java | 14 +++++++-------
.../java/org/apache/camel/component/rest/RestEndpoint.java | 10 +++-------
4 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http4/HttpComponent.java b/components/camel-http/src/main/java/org/apache/camel/component/http4/HttpComponent.java
index f0260f4..ab4ec4d 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http4/HttpComponent.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http4/HttpComponent.java
@@ -429,10 +429,10 @@ public class HttpComponent extends HttpCommonComponent implements RestProducerFa
if (!ObjectHelper.isEmpty(uriTemplate)) {
url += "/" + uriTemplate;
}
-
+
RestConfiguration config = configuration;
if (config == null) {
- config = camelContext.getRestConfiguration("http", false);
+ config = camelContext.getRestConfiguration("http", true);
}
Map<String, Object> map = new HashMap<>();
diff --git a/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java b/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java
index d28a42d..6bcae93 100644
--- a/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java
+++ b/components/camel-rest-swagger/src/main/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpoint.java
@@ -61,7 +61,6 @@ import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.apache.camel.support.DefaultEndpoint;
-import org.apache.camel.support.LazyStartProducer;
import org.apache.camel.support.ResourceHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.StringHelper;
@@ -284,6 +283,12 @@ public final class RestSwaggerEndpoint extends DefaultEndpoint {
boolean hasHost = params.containsKey("host");
setProperties(endpoint, params);
+ // ensure rest configuration is available
+// final String componentName = determineComponentName();
+// if (componentName != null) {
+// RestConfiguration config = camelContext.getRestConfiguration(componentName, true);
+// }
+
// if there is a host then we should use this hardcoded host instead of any Header that may have an existing
// Host header from some other HTTP input, and if so then lets remove it
return new RestSwaggerProducer(endpoint.createAsyncProducer(), hasHost);
@@ -328,7 +333,7 @@ public final class RestSwaggerEndpoint extends DefaultEndpoint {
final String componentName = determineComponentName();
if (componentName != null) {
- parameters.put("componentName", componentName);
+ parameters.put("producerComponentName", componentName);
}
final String host = determineHost(swagger);
diff --git a/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpointTest.java b/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpointTest.java
index 33911f9..8b4b432 100644
--- a/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpointTest.java
+++ b/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerEndpointTest.java
@@ -137,39 +137,39 @@ public class RestSwaggerEndpointTest {
component.setComponentName("xyz");
assertThat(endpoint.determineEndpointParameters(swagger, operation))
- .containsOnly(entry("host", "http://petstore.swagger.io"), entry("componentName", "xyz"));
+ .containsOnly(entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "xyz"));
swagger.consumes("application/json").produces("application/xml");
assertThat(endpoint.determineEndpointParameters(swagger, operation)).containsOnly(
- entry("host", "http://petstore.swagger.io"), entry("componentName", "xyz"),
+ entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "xyz"),
entry("consumes", "application/xml"), entry("produces", "application/json"));
component.setProduces("application/json");
component.setConsumes("application/atom+xml");
assertThat(endpoint.determineEndpointParameters(swagger, operation)).containsOnly(
- entry("host", "http://petstore.swagger.io"), entry("componentName", "xyz"),
+ entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "xyz"),
entry("consumes", "application/atom+xml"), entry("produces", "application/json"));
endpoint.setProduces("application/atom+xml");
endpoint.setConsumes("application/json");
assertThat(endpoint.determineEndpointParameters(swagger, operation)).containsOnly(
- entry("host", "http://petstore.swagger.io"), entry("componentName", "xyz"),
+ entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "xyz"),
entry("consumes", "application/json"), entry("produces", "application/atom+xml"));
endpoint.setComponentName("zyx");
assertThat(endpoint.determineEndpointParameters(swagger, operation)).containsOnly(
- entry("host", "http://petstore.swagger.io"), entry("componentName", "zyx"),
+ entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "zyx"),
entry("consumes", "application/json"), entry("produces", "application/atom+xml"));
operation.addParameter(new QueryParameter().name("q").required(true));
assertThat(endpoint.determineEndpointParameters(swagger, operation)).containsOnly(
- entry("host", "http://petstore.swagger.io"), entry("componentName", "zyx"),
+ entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "zyx"),
entry("consumes", "application/json"), entry("produces", "application/atom+xml"),
entry("queryParameters", "q={q}"));
operation.addParameter(new QueryParameter().name("o"));
assertThat(endpoint.determineEndpointParameters(swagger, operation)).containsOnly(
- entry("host", "http://petstore.swagger.io"), entry("componentName", "zyx"),
+ entry("host", "http://petstore.swagger.io"), entry("producerComponentName", "zyx"),
entry("consumes", "application/json"), entry("produces", "application/atom+xml"),
entry("queryParameters", "q={q}&o={o?}"));
}
diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
index d6ab43c..f2aab6f 100644
--- a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
+++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java
@@ -377,12 +377,8 @@ public class RestEndpoint extends DefaultEndpoint {
if (factory != null) {
log.debug("Using RestProducerFactory: {}", factory);
-
- RestConfiguration config = getCamelContext().getRestConfiguration(pname, false);
- if (config == null) {
- // fallback to default
- config = getCamelContext().getRestConfiguration();
- }
+
+ RestConfiguration config = getCamelContext().getRestConfiguration(pname, true);
Producer producer;
if (apiDocFactory != null) {
@@ -392,7 +388,7 @@ public class RestEndpoint extends DefaultEndpoint {
} else {
producer = factory.createProducer(getCamelContext(), host, method, path, uriTemplate, queryParameters, consumes, produces, config, parameters);
}
-
+
RestProducer answer = new RestProducer(this, producer, config);
answer.setOutType(outType);
answer.setType(inType);
[camel] 02/02: Fixed example as swagger petstorre uses https now
and http4 works OOTB where as undertow dont
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit fce66e0e1c0daed01885abc4005d257210cb3204
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 9 10:12:40 2019 +0200
Fixed example as swagger petstorre uses https now and http4 works OOTB where as undertow dont
---
examples/camel-example-rest-swagger/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/camel-example-rest-swagger/pom.xml b/examples/camel-example-rest-swagger/pom.xml
index 1ffadd9..e95049b 100644
--- a/examples/camel-example-rest-swagger/pom.xml
+++ b/examples/camel-example-rest-swagger/pom.xml
@@ -65,7 +65,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-undertow-starter</artifactId>
+ <artifactId>camel-http-starter</artifactId>
</dependency>
<dependency>