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 2013/04/12 06:12:44 UTC
svn commit: r1467164 - in /camel/trunk:
components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/
components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/
components/camel-cxf/src/test/resources/org/apache/camel/component...
Author: ningjiang
Date: Fri Apr 12 04:12:43 2013
New Revision: 1467164
URL: http://svn.apache.org/r1467164
Log:
CAMEL-6253 fix the issues of HTTP_PATH header and JettyToCxfRs proxy
Added:
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/JettyCxfRsRouterTest.java
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRouterTest.java
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java Fri Apr 12 04:12:43 2013
@@ -39,6 +39,8 @@ public class CxfRsHeaderFilterStrategy e
getOutFilter().add(Exchange.HTTP_METHOD);
getOutFilter().add(Exchange.HTTP_PATH);
getOutFilter().add(Exchange.DESTINATION_OVERRIDE_URL);
+ // filter headers begin with "Camel" or "org.apache.camel"
+ setOutFilterPattern("(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
}
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java Fri Apr 12 04:12:43 2013
@@ -132,8 +132,9 @@ public class DefaultCxfRsBinding impleme
MultivaluedMap<String, String> answer = new MetadataMap<String, String>();
for (Map.Entry<String, Object> entry : camelHeaders.entrySet()) {
-
- if (headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), camelExchange)) {
+ // Need to make sure the cxf needed header will not be filtered
+ if (headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), camelExchange)
+ && camelToCxfHeaderMap.get(entry.getKey()) == null) {
LOG.trace("Drop Camel header: {}={}", entry.getKey(), entry.getValue());
continue;
}
Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRouterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRouterTest.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRouterTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsRouterTest.java Fri Apr 12 04:12:43 2013
@@ -33,10 +33,14 @@ import org.springframework.context.suppo
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class CxfRsRouterTest extends CamelSpringTestSupport {
- private static final int PORT0 = CXFTestSupport.getPort1();
+ private static final int PORT = CXFTestSupport.getPort1();
private static final String PUT_REQUEST = "<Customer><name>Mary</name><id>123</id></Customer>";
private static final String POST_REQUEST = "<Customer><name>Jack</name></Customer>";
+
+ protected int getPort() {
+ return PORT;
+ }
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
@@ -55,7 +59,7 @@ public class CxfRsRouterTest extends Cam
@Test
public void testGetCustomer() throws Exception {
- HttpGet get = new HttpGet("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers/123");
+ HttpGet get = new HttpGet("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/123");
get.addHeader("Accept" , "application/json");
HttpClient httpclient = new DefaultHttpClient();
@@ -72,7 +76,7 @@ public class CxfRsRouterTest extends Cam
@Test
public void testGetCustomerWithQuery() throws Exception {
- HttpGet get = new HttpGet("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers?id=123");
+ HttpGet get = new HttpGet("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers?id=123");
get.addHeader("Accept" , "application/json");
HttpClient httpclient = new DefaultHttpClient();
@@ -87,8 +91,8 @@ public class CxfRsRouterTest extends Cam
}
@Test
- public void testGetCustomers() throws Exception {
- HttpGet get = new HttpGet("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers/");
+ public void testGetCustomers() throws Exception {
+ HttpGet get = new HttpGet("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/");
get.addHeader("Accept" , "application/xml");
HttpClient httpclient = new DefaultHttpClient();
@@ -111,7 +115,7 @@ public class CxfRsRouterTest extends Cam
@Test
public void testGetSubResource() throws Exception {
- HttpGet get = new HttpGet("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/orders/223/products/323");
+ HttpGet get = new HttpGet("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/orders/223/products/323");
get.addHeader("Accept" , "application/json");
HttpClient httpclient = new DefaultHttpClient();
@@ -127,7 +131,7 @@ public class CxfRsRouterTest extends Cam
@Test
public void testPutConsumer() throws Exception {
- HttpPut put = new HttpPut("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers");
+ HttpPut put = new HttpPut("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers");
StringEntity entity = new StringEntity(PUT_REQUEST, "ISO-8859-1");
entity.setContentType("text/xml; charset=ISO-8859-1");
put.setEntity(entity);
@@ -144,7 +148,7 @@ public class CxfRsRouterTest extends Cam
@Test
public void testPostConsumer() throws Exception {
- HttpPost post = new HttpPost("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers");
+ HttpPost post = new HttpPost("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers");
post.addHeader("Accept" , "text/xml");
StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
entity.setContentType("text/xml; charset=ISO-8859-1");
@@ -157,7 +161,7 @@ public class CxfRsRouterTest extends Cam
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
EntityUtils.toString(response.getEntity()));
- HttpDelete del = new HttpDelete("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers/124/");
+ HttpDelete del = new HttpDelete("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/124/");
httpclient.execute(del);
} finally {
httpclient.getConnectionManager().shutdown();
@@ -167,7 +171,7 @@ public class CxfRsRouterTest extends Cam
@Test
public void testPostConsumerUniqueResponseCode() throws Exception {
- HttpPost post = new HttpPost("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customersUniqueResponseCode");
+ HttpPost post = new HttpPost("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customersUniqueResponseCode");
post.addHeader("Accept" , "text/xml");
StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
entity.setContentType("text/xml; charset=ISO-8859-1");
@@ -180,7 +184,7 @@ public class CxfRsRouterTest extends Cam
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
EntityUtils.toString(response.getEntity()));
- HttpDelete del = new HttpDelete("http://localhost:" + PORT0 + "/CxfRsRouterTest/route/customerservice/customers/124/");
+ HttpDelete del = new HttpDelete("http://localhost:" + getPort() + "/CxfRsRouterTest/route/customerservice/customers/124/");
httpclient.execute(del);
} finally {
httpclient.getConnectionManager().shutdown();
Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/JettyCxfRsRouterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/JettyCxfRsRouterTest.java?rev=1467164&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/JettyCxfRsRouterTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/JettyCxfRsRouterTest.java Fri Apr 12 04:12:43 2013
@@ -0,0 +1,41 @@
+/**
+ * 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.cxf.jaxrs;
+
+import org.apache.camel.component.cxf.CXFTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class JettyCxfRsRouterTest extends CxfRsRouterTest {
+ private static final int PORT2 = CXFTestSupport.getPort5();
+ @Override
+ protected int getPort() {
+ return PORT2;
+ }
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml");
+ }
+
+ @Test
+ public void testEndpointUris() throws Exception {
+ // Don't test anything here
+ }
+
+}
Added: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml?rev=1467164&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml (added)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/JettyCxfRsSpringRouter.xml Fri Apr 12 04:12:43 2013
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!-- START SNIPPET: cxfRsExample -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cxf="http://camel.apache.org/schema/cxf"
+ xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+ <!-- Defined the real JAXRS back end service -->
+ <jaxrs:server id="restService"
+ address="http://localhost:${CXFTestSupport.port2}/JettyCxfRsRouterTest/rest"
+ staticSubresourceResolution="true">
+ <jaxrs:serviceBeans>
+ <ref bean="customerService"/>
+ </jaxrs:serviceBeans>
+ </jaxrs:server>
+
+ <!-- bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.JSONProvider"/-->
+
+ <bean id="customerService" class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" />
+
+ <!-- Defined the client endpoint to create the cxf-rs consumer -->
+ <cxf:rsClient id="rsClient" address="http://localhost:${CXFTestSupport.port2}/JettyCxfRsRouterTest/rest"
+ serviceClass="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+ loggingFeatureEnabled="true" skipFaultLogging="true"/>
+
+ <!-- The camel route context -->
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true">
+ <route>
+ <!-- Jetty server can be used to proxy the request to cxfrs client -->
+ <from uri="jetty://http://localhost:{{CXFTestSupport.port5}}/CxfRsRouterTest/route?matchOnUriPrefix=true&bridgeEndpoint=true"/>
+ <!-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -->
+ <setHeader headerName="CamelCxfRsUsingHttpAPI">
+ <constant>True</constant>
+ </setHeader>
+ <to uri="cxfrs://bean://rsClient"/>
+ </route>
+ </camelContext>
+
+</beans>
+<!-- START SNIPPET: cxfRsExample -->
Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/CamelServlet.java Fri Apr 12 04:12:43 2013
@@ -98,11 +98,18 @@ public class CamelServlet extends HttpSe
ClassLoader oldTccl = overrideTccl(exchange);
HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
exchange.setIn(new HttpMessage(exchange, request, response));
-
// set context path as header
String contextPath = consumer.getEndpoint().getPath();
exchange.getIn().setHeader("CamelServletContextPath", contextPath);
+ String httpPath = (String)exchange.getIn().getHeader(Exchange.HTTP_PATH);
+ // here we just remove the CamelServletContextPath part from the HTTP_PATH
+ if (contextPath != null
+ && httpPath.startsWith(contextPath)) {
+ exchange.getIn().setHeader(Exchange.HTTP_PATH,
+ httpPath.substring(contextPath.length()));
+ }
+
try {
log.trace("Processing request for exchangeId: {}", exchange.getExchangeId());
// process the exchange
Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java (original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java Fri Apr 12 04:12:43 2013
@@ -180,32 +180,10 @@ public final class HttpHelper {
// append HTTP_PATH to HTTP_URI if it is provided in the header
String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
+ // NOW the HTTP_PATH is just related path, we don't need to trim it
if (path != null) {
if (path.startsWith("/")) {
- URI baseURI;
- String baseURIString = exchange.getIn().getHeader(Exchange.HTTP_BASE_URI, String.class);
- try {
- if (baseURIString == null) {
- if (exchange.getFromEndpoint() != null) {
- baseURIString = exchange.getFromEndpoint().getEndpointUri();
- } else {
- // will set a default one for it
- baseURIString = "/";
- }
- }
- baseURI = new URI(baseURIString);
- String basePath = baseURI.getPath();
- if (path.startsWith(basePath)) {
- path = path.substring(basePath.length());
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- } else {
- throw new RuntimeExchangeException("Cannot analyze the Exchange.HTTP_PATH header, due to: cannot find the right HTTP_BASE_URI", exchange);
- }
- } catch (Throwable t) {
- throw new RuntimeExchangeException("Cannot analyze the Exchange.HTTP_PATH header, due to: " + t.getMessage(), exchange, t);
- }
+ path = path.substring(1);
}
if (path.length() > 0) {
// make sure that there is exactly one "/" between HTTP_URI and
Modified: camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java (original)
+++ camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java Fri Apr 12 04:12:43 2013
@@ -180,33 +180,10 @@ public final class HttpHelper {
// append HTTP_PATH to HTTP_URI if it is provided in the header
String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
+ // NOW the HTTP_PATH is just related path, we don't need to trim it
if (path != null) {
if (path.startsWith("/")) {
- URI baseURI;
- String baseURIString = exchange.getIn().getHeader(Exchange.HTTP_BASE_URI, String.class);
- try {
- if (baseURIString == null) {
- if (exchange.getFromEndpoint() != null) {
- baseURIString = exchange.getFromEndpoint().getEndpointUri();
- } else {
- // will set a default one for it
- baseURIString = "/";
- }
- }
- baseURI = new URI(baseURIString);
- String basePath = baseURI.getPath();
- if (path.startsWith(basePath)) {
- path = path.substring(basePath.length());
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- } else {
- throw new RuntimeExchangeException("Cannot analyze the Exchange.HTTP_PATH header, due to: cannot find the right HTTP_BASE_URI", exchange);
- }
- } catch (Throwable t) {
- throw new RuntimeExchangeException("Cannot analyze the Exchange.HTTP_PATH header, due to: " + t.getMessage(), exchange, t);
- }
-
+ path = path.substring(1);
}
if (path.length() > 0) {
// make sure that there is exactly one "/" between HTTP_URI and
Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java (original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java Fri Apr 12 04:12:43 2013
@@ -108,12 +108,20 @@ public class CamelContinuationServlet ex
}
HttpHelper.setCharsetFromContentType(request.getContentType(), exchange);
+
exchange.setIn(new HttpMessage(exchange, request, response));
-
// set context path as header
String contextPath = consumer.getEndpoint().getPath();
exchange.getIn().setHeader("CamelServletContextPath", contextPath);
-
+
+ String httpPath = (String)exchange.getIn().getHeader(Exchange.HTTP_PATH);
+ // here we just remove the CamelServletContextPath part from the HTTP_PATH
+ if (contextPath != null
+ && httpPath.startsWith(contextPath)) {
+ exchange.getIn().setHeader(Exchange.HTTP_PATH,
+ httpPath.substring(contextPath.length()));
+ }
+
log.trace("Suspending continuation of exchangeId: {}", exchange.getExchangeId());
continuation.setAttribute(EXCHANGE_ATTRIBUTE_ID, exchange.getExchangeId());
// must suspend before we process the exchange
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java Fri Apr 12 04:12:43 2013
@@ -65,7 +65,7 @@ public class HttpProxyRouteTest extends
from("jetty://http://localhost:{{port}}/bye").transform(header("foo").prepend("Bye "));
- from("jetty://http://localhost:{{port}}/otherEndpoint?matchOnUriPrefix=true").transform(header(Exchange.HTTP_PATH));
+ from("jetty://http://localhost:{{port}}/otherEndpoint?matchOnUriPrefix=true").transform(header(Exchange.HTTP_URI));
from("jetty://http://localhost:{{port}}/proxyServer")
.to("http://localhost:{{port2}}/host?bridgeEndpoint=true");
Modified: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java?rev=1467164&r1=1467163&r2=1467164&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java (original)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/issues/JettyHttpTest.java Fri Apr 12 04:12:43 2013
@@ -23,9 +23,6 @@ import org.apache.camel.component.mock.M
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-/**
- * @version
- */
public class JettyHttpTest extends CamelTestSupport {
private String targetProducerUri = "http://localhost:8542/someservice?bridgeEndpoint=true&throwExceptionOnFailure=false";
@@ -60,7 +57,7 @@ public class JettyHttpTest extends Camel
from(targetConsumerUri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- String path = exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
+ String path = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
exchange.getOut().setBody("Hi! " + path);
}
});