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 2022/08/13 18:52:00 UTC
[camel] branch main updated (03bad9d0ccc -> 4766731eb75)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from 03bad9d0ccc CAMEL-18390: [camel-hyperledger-aries] Component should not maintain websocket connection(s) (#8159)
add aaa692c7a38 HttpSendDynamicAware not optimizing for http:hostname[:port][/resourceUri][?options]
new 240ae8d94ce Merge branch 'main' of https://github.com/jeroenbellen/camel into jeroenbellen-main
new 0366ebf6aea HttpSendDynamicAware not optimizing for http:hostname\[:port\]\[/resourceUri\]\[\?options\]
new 4766731eb75 Merge branch 'jeroenbellen-main'
The 3 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:
.../camel/http/base/HttpSendDynamicAware.java | 10 ++
.../HttpSendDynamicAwareUriWithoutSlashTest.java | 108 +++++++++++++++++++++
2 files changed, 118 insertions(+)
create mode 100644 components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
[camel] 02/03: HttpSendDynamicAware not optimizing for http:hostname\[:port\]\[/resourceUri\]\[\?options\]
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0366ebf6aea7e37a6215834b4fd0f1e753e28333
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 13 20:51:42 2022 +0200
HttpSendDynamicAware not optimizing for http:hostname\[:port\]\[/resourceUri\]\[\?options\]
---
.../camel/http/base/HttpSendDynamicAware.java | 10 ++++++++
.../HttpSendDynamicAwareUriWithoutSlashTest.java | 29 ++++++++++++++--------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java b/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java
index b9675cc0287..e476bc923c7 100644
--- a/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java
+++ b/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpSendDynamicAware.java
@@ -153,6 +153,16 @@ public class HttpSendDynamicAware extends SendDynamicAwareSupport {
}
}
+ // must include :// in scheme to be parsable via java.net.URI
+ int colon = u.indexOf(':');
+ if (colon != -1) {
+ String before = StringHelper.before(u, ":");
+ String after = StringHelper.after(u, ":");
+ if (!after.startsWith("//")) {
+ u = before + "://" + after;
+ }
+ }
+
// favour using java.net.URI for parsing into host, context-path and authority
try {
URI parse = new URI(u);
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
index be8bd1a3906..bfb3e9c9e12 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSendDynamicAwareUriWithoutSlashTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.http;
import java.util.Map;
@@ -82,18 +98,11 @@ public class HttpSendDynamicAwareUriWithoutSlashTest extends BaseHttpTest {
out = fluentTemplate.to("direct:usersDrinkWithoutSlash").withExchange(ExchangeBuilder.anExchange(context).withProperty("user", "moes").build()).send();
assertEquals("a user", out.getMessage().getBody(String.class));
- /*
- Using http:hostname[:port][/resourceUri][?options] as documented https://camel.apache.org/components/3.18.x/http-component.html stops the optimization
-
- org.apache.camel.http.base.HttpSendDynamicAware Line 158 breaks the logic
-
- URI parse = new URI(u);
- */
+ // and there should only be one http endpoint as they are both on same host
Map<String, Endpoint> endpointMap = context.getEndpointMap();
- assertTrue(endpointMap.containsKey("http://localhost:" + localServer.getLocalPort() + "/users/joes"), "Not optimized");
- assertTrue(endpointMap.containsKey("http://localhost:" + localServer.getLocalPort() + "/users/moes"), "Not optimized");
+ assertTrue(endpointMap.containsKey("http://localhost:" + localServer.getLocalPort()), "Should find static uri");
assertTrue(endpointMap.containsKey("direct://usersDrink"), "Should find direct");
assertTrue(endpointMap.containsKey("direct://usersDrinkWithoutSlash"), "Should find direct");
- assertEquals(4, endpointMap.size());
+ assertEquals(3, endpointMap.size());
}
}
[camel] 03/03: Merge branch 'jeroenbellen-main'
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 4766731eb75c27249bf790a61056d08156f865a5
Merge: 03bad9d0ccc 0366ebf6aea
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 13 20:51:52 2022 +0200
Merge branch 'jeroenbellen-main'
.../camel/http/base/HttpSendDynamicAware.java | 10 ++
.../HttpSendDynamicAwareUriWithoutSlashTest.java | 108 +++++++++++++++++++++
2 files changed, 118 insertions(+)
[camel] 01/03: Merge branch 'main' of https://github.com/jeroenbellen/camel into jeroenbellen-main
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 240ae8d94ce27e0e24989a9d834b5a8de343efd6
Merge: 03bad9d0ccc aaa692c7a38
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 13 20:36:08 2022 +0200
Merge branch 'main' of https://github.com/jeroenbellen/camel into jeroenbellen-main
.../HttpSendDynamicAwareUriWithoutSlashTest.java | 99 ++++++++++++++++++++++
1 file changed, 99 insertions(+)