You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/02/22 05:44:46 UTC

git commit: CAMEL-7228 Avoid setting port number for default number

Repository: camel
Updated Branches:
  refs/heads/master 6ed01be15 -> a70104feb


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/a70104fe
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a70104fe
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a70104fe

Branch: refs/heads/master
Commit: a70104feb56bbe97c0bb39b5c8b5bb67cd5b56e9
Parents: 6ed01be
Author: Willem Jiang <wi...@gmail.com>
Authored: Sat Feb 22 12:33:13 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sat Feb 22 12:38:53 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/a70104fe/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 db15a64..1e80f00 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
@@ -266,14 +266,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/a70104fe/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());
+    }
 
 }