camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1373725 - in /camel/branches/camel-2.10.x: ./ components/camel-http/src/main/java/org/apache/camel/component/http/ components/camel-http4/src/main/java/org/apache/camel/component/http4/ components/camel-jetty/src/main/java/org/apache/camel...
Date Thu, 16 Aug 2012 03:42:36 GMT
Author: ningjiang
Date: Thu Aug 16 03:42:35 2012
New Revision: 1373725

URL: http://svn.apache.org/viewvc?rev=1373725&view=rev
Log:
Merged revisions 1373691,1373722 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1373691 | ningjiang | 2012-08-16 10:02:01 +0800 (Thu, 16 Aug 2012) | 1 line
  
  CAMEL-5509 Fix the empty path issue of http consumer
........
  r1373722 | ningjiang | 2012-08-16 11:37:11 +0800 (Thu, 16 Aug 2012) | 1 line
  
  CAMEL-5509 Applied path to camel-http4
........

Modified:
    camel/branches/camel-2.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
    camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
    camel/branches/camel-2.10.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
    camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1373691,1373722

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=1373725&r1=1373724&r2=1373725&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
Thu Aug 16 03:42:35 2012
@@ -207,7 +207,8 @@ public class HttpEndpoint extends Defaul
     }
 
     public String getPath() {
-        return httpUri.getPath();
+        //if the path is empty, we just return the default path here
+        return httpUri.getPath().length() == 0 ? "/" : httpUri.getPath();
     }
 
     public int getPort() {

Modified: camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java?rev=1373725&r1=1373724&r2=1373725&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
Thu Aug 16 03:42:35 2012
@@ -224,7 +224,8 @@ public class HttpEndpoint extends Defaul
     }
 
     public String getPath() {
-        return httpUri.getPath();
+        //if the path is empty, we just return the default path here
+        return httpUri.getPath().length() == 0 ? "/" : httpUri.getPath();
     }
 
     public int getPort() {

Modified: camel/branches/camel-2.10.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java?rev=1373725&r1=1373724&r2=1373725&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
Thu Aug 16 03:42:35 2012
@@ -198,7 +198,6 @@ public class JettyHttpComponent extends 
         URI endpointUri = URISupport.createRemainingURI(addressUri, httpClientParameters);
         // restructure uri to be based on the parameters left as we dont want to include
the Camel internal options
         URI httpUri = URISupport.createRemainingURI(addressUri, parameters);
-     
         // create endpoint after all known parameters have been extracted from parameters
         JettyHttpEndpoint endpoint = new JettyHttpEndpoint(this, endpointUri.toString(),
httpUri);
         setEndpointHeaderFilterStrategy(endpoint);

Modified: camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java?rev=1373725&r1=1373724&r2=1373725&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
Thu Aug 16 03:42:35 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.jetty;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.util.StopWatch;
 import org.apache.camel.util.TimeUtils;
@@ -31,20 +32,34 @@ public class HttpProxyRouteTest extends 
 
         StopWatch watch = new StopWatch();
         for (int i = 0; i < size; i++) {
-            String out = template.requestBody("http://localhost:{{port}}/hello?foo=" + i,
null, String.class);
+            String out = template.requestBody("http://localhost:{{port}}?foo=" + i, null,
String.class);
             assertEquals("Bye " + i, out);
         }
 
         log.info("Time taken: " + TimeUtils.printDuration(watch.taken()));
     }
+    
+    @Test
+    public void testHttpProxyWithDifferentPath() throws Exception {
+        String out = template.requestBody("http://localhost:{{port}}/proxy", null, String.class);
+        assertEquals("/otherEndpoint", out);
+        
+        out = template.requestBody("http://localhost:{{port}}/proxy/path", null, String.class);
+        assertEquals("/otherEndpoint/path", out);
+    }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("jetty://http://localhost:{{port}}/hello")
+                from("jetty://http://localhost:{{port}}")
                     .to("http://localhost:{{port}}/bye?throwExceptionOnFailure=false&bridgeEndpoint=true");
+                
+                from("jetty://http://localhost:{{port}}/proxy?matchOnUriPrefix=true")
+                    .to("http://localhost:{{port}}/otherEndpoint?throwExceptionOnFailure=false&bridgeEndpoint=true");
 
                 from("jetty://http://localhost:{{port}}/bye").transform(header("foo").prepend("Bye
"));
+                
+                from("jetty://http://localhost:{{port}}/otherEndpoint?matchOnUriPrefix=true").transform(header(Exchange.HTTP_PATH));
             }
         };
     }    



Mime
View raw message