camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (CAMEL-2510) Mixing jetty/http in a route screws up the URI used by HttpClient
Date Thu, 04 Mar 2010 08:11:44 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-2510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58016#action_58016
] 

Willem Jiang edited comment on CAMEL-2510 at 3/4/10 8:11 AM:
-------------------------------------------------------------

@Claus,

I need to make my change more clear, lets take the REST service as an example, the relative
path could be used for URI template.
If we use the jetty and http component to build a bridge, my change will support it out of
box.
{code}
from("jetty:http://localhost/input?matchOnUriPrefix=true").to("http://localhost:8080/outservice?bridgeEndpoint=true");
{code}

For the HttpProducer, our police is the message header of HTTP_PATH and HTTP_URI can override
the http endpoint configuration, and we introduce the bridgeEndpoint option to ignore the
message header of HTTP_URI.    
If you want to this route implement Roman's requirement, current solution could be 
{code}
rom("jetty:http://localhost/input?matchOnUriPrefix=true").setHeader(Exchange.HTTP_PATH, constant("")).to("http://localhost:8080/outservice?bridgeEndpoint=true");
{code}

      was (Author: njiang):
    @Claus,

I need to make my change more clear, lets take the REST service as an example, the relative
path could be used for URI template.
If we use the jetty and http component to build a bridge, my change will support it out of
box.
{code}
from("jetty:http://localhost/input?matchOnUriPrefix=true").to("http://localhost:8080/outservice?bridgeEndpoint=true");
{code}

For the HttpProducer, our police is the message header of HTTP_PATH and HTTP_URI can override
the http endpoint configuration, and we introduce the bridgeEndpoint option to ignore the
message header of HTTP_URI.    
If you want to this route implement Roman's requirement, current solution could be 
rom("jetty:http://localhost/input?matchOnUriPrefix=true").setHeader(Exchange.HTTP_PATH, constant("")).to("http://localhost:8080/outservice?bridgeEndpoint=true");
  
> 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.


Mime
View raw message