camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject git commit: CAMEL-7228 Avoid setting port number for default number
Date Sat, 22 Feb 2014 04:49:57 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 08e05a041 -> 4862a5fe9


CAMEL-7228 Avoid setting port number for default number


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

Branch: refs/heads/camel-2.12.x
Commit: 4862a5fe9b63193ad8c6aad1d086eebb4986e164
Parents: 08e05a0
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Sat Feb 22 12:33:13 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Sat Feb 22 12:49:24 2014 +0800

----------------------------------------------------------------------
 .../org/apache/camel/component/http4/HttpComponent.java  |  4 ++--
 .../camel/component/http4/HttpEndpointURLTest.java       | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4862a5fe/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
index cad548a..485b1fa 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
@@ -262,14 +262,14 @@ public class HttpComponent extends HeaderFilterStrategyComponent {
         setProperties(endpoint, parameters);
 
         // determine the portnumber (special case: default portnumber)
-        int port = getPort(uriHttpUriAddress);
+        //int port = getPort(uriHttpUriAddress);
 
         // we can not change the port of an URI, we must create a new one with an explicit
port value
         URI httpUri = URISupport.createRemainingURI(
                 new URI(uriHttpUriAddress.getScheme(),
                         uriHttpUriAddress.getUserInfo(),
                         uriHttpUriAddress.getHost(),
-                        port,
+                        uriHttpUriAddress.getPort(),
                         uriHttpUriAddress.getPath(),
                         uriHttpUriAddress.getQuery(),
                         uriHttpUriAddress.getFragment()),

http://git-wip-us.apache.org/repos/asf/camel/blob/4862a5fe/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java
b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java
index d176f2f..eadd2b5 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java
@@ -26,5 +26,16 @@ public class HttpEndpointURLTest extends CamelTestSupport {
         HttpEndpoint endpoint = (HttpEndpoint)context.getEndpoint("http4://[2a00:8a00:6000:40::1413]:30300/test?test=true");
         assertEquals("http://[2a00:8a00:6000:40::1413]:30300/test?test=true", endpoint.getHttpUri().toString());
     }
+    
+    @Test
+    public void testHttpEndpointHttpUri() throws Exception {
+        HttpEndpoint http1 = context.getEndpoint("http4://www.google.com", HttpEndpoint.class);
+        HttpEndpoint http2 = context.getEndpoint("https4://www.google.com?test=parameter&proxyAuthHost=myotherproxy&proxyAuthPort=2345",
HttpEndpoint.class);
+        HttpEndpoint http3 = context.getEndpoint("https4://www.google.com?test=parameter",
HttpEndpoint.class);
+       
+        assertEquals("Get a wrong HttpUri of http1", "http://www.google.com", http1.getHttpUri().toString());
+        assertEquals("Get a wrong HttpUri of http2", "https://www.google.com?test=parameter",
http2.getHttpUri().toString());
+        assertEquals("Get a wrong HttpUri of http2 andhttp3", http2.getHttpUri(), http3.getHttpUri());
+    }
 
 }


Mime
View raw message