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 2012/08/16 06:05:34 UTC
svn commit: r1373728 - in /camel/branches/camel-2.9.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/...
Author: ningjiang
Date: Thu Aug 16 04:05:34 2012
New Revision: 1373728
URL: http://svn.apache.org/viewvc?rev=1373728&view=rev
Log:
Merged revisions 1373725 via svnmerge from
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
................
r1373725 | ningjiang | 2012-08-16 11:42:35 +0800 (Thu, 16 Aug 2012) | 13 lines
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.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
camel/branches/camel-2.9.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
camel/branches/camel-2.9.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1373691,1373722
Merged /camel/branches/camel-2.10.x:r1373725
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java?rev=1373728&r1=1373727&r2=1373728&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java (original)
+++ camel/branches/camel-2.9.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java Thu Aug 16 04:05:34 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.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java?rev=1373728&r1=1373727&r2=1373728&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java (original)
+++ camel/branches/camel-2.9.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEndpoint.java Thu Aug 16 04:05:34 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.9.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java?rev=1373728&r1=1373727&r2=1373728&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java (original)
+++ camel/branches/camel-2.9.x/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java Thu Aug 16 04:05:34 2012
@@ -199,7 +199,6 @@ public class JettyHttpComponent extends
URI endpointUri = URISupport.createRemainingURI(addressUri, CastUtils.cast(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, CastUtils.cast(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.9.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java?rev=1373728&r1=1373727&r2=1373728&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java (original)
+++ camel/branches/camel-2.9.x/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java Thu Aug 16 04:05:34 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));
}
};
}