[
https://issues.apache.org/activemq/browse/CAMEL-2510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57996#action_57996
]
Roman Kalukiewicz commented on CAMEL-2510:
------------------------------------------
I believe I was misunderstood :)
I'm not saying that we shouldn't send HTTP_PATH or HTTP_URI headers at all. I
believe they are needed definitely (as you wrote earlier). I just believe that
by default some other headers should be used to override the URI used at
HttpProducer.
Assuming we have a route like
{code:java}
from("jetty:http://localhost/input?matchOnUriPrefix=true").to("http://localhost:/output");
{code}
When someone sends a POST to {{http://localhost/input/some/path}} the payload
should be sent to {{http://localhost/output}} not to
{{http://localhost/output/some/path}}
> Mixing jetty/http in a route screws up the URI used by HttpClient
> -----------------------------------------------------------------
>
> Key: CAMEL-2510
> URL: https://issues.apache.org/activemq/browse/CAMEL-2510
> Project: Apache Camel
> Issue Type: Bug
> Affects Versions: 2.1.0, 2.2.0
> Reporter: Willem Jiang
> Assignee: Willem Jiang
> Fix For: 2.3.0
>
>
> Below test shows the Http producer can't build up right HttpRequest URI as a
> bridgeEndpoint.
> {code}
> public class JettyHttpTest extends CamelTestSupport {
> private String targetProducerUri =
> "http://localhost:8542/someservice?bridgeEndpoint=true&throwExceptionOnFailure=false";
> private String targetConsumerUri =
> "jetty:http://localhost:8542/someservice?matchOnUriPrefix=true";
> private String sourceUri =
> "jetty:http://localhost:6323/myservice?matchOnUriPrefix=true";
> private String sourceProducerUri = "http://localhost:6323/myservice";
> @Test
> public void testGetRootPath() throws Exception {
> MockEndpoint mock = getMockEndpoint("mock:result");
> mock.expectedBodiesReceived("Hi! /someservice");
> template.sendBody("direct:root", "");
> assertMockEndpointsSatisfied();
> }
>
> @Test
> public void testGetWithRelativePath() throws Exception {
> MockEndpoint mock = getMockEndpoint("mock:result");
> mock.expectedBodiesReceived("Hi! /someservice/relative");
>
> template.sendBody("direct:relative", "");
> assertMockEndpointsSatisfied();
>
> }
> @Override
> protected RouteBuilder createRouteBuilder() throws Exception {
> return new RouteBuilder() {
> @Override
> public void configure() throws Exception {
> from(targetConsumerUri)
> .process(new Processor() {
> public void process(Exchange exchange) throws
> Exception {
> String path =
> exchange.getIn().getHeader(Exchange.HTTP_PATH, String.class);
> exchange.getOut().setBody("Hi! " + path);
> }
> });
> from(sourceUri)
> .to(targetProducerUri);
> from("direct:root")
> .to(sourceProducerUri)
> .to("mock:result");
>
> from("direct:relative")
> .to(sourceProducerUri + "/relative")
> .to("mock:result");
> }
> };
> }
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.