You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by samslara <sa...@yahoo.com> on 2013/12/19 21:16:41 UTC

Camel Jetty component and overlapping urls when a consumer

Hello,
  I have a question about the behavior of the jetty component when in an
OSGi environment (such as in ServiceMix).  If I have two bundles each with a
camel context where one has a route such as:

<from uri="jetty:http://0.0.0.0:8080/"/>
...

and the other has a route such as:

<from uri="jetty:http://0.0.0.0:8080/application1"/>
...

and I call the container with

http://<myip>:8080/application1/a/b/c

Because of the overlapping url but with the second route being more specific
will this request go to the 2nd route, the 1st route, randomly to either or
will something else occur?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty component and overlapping urls when a consumer

Posted by Claus Ibsen <cl...@gmail.com>.
No you are correct, the camel-jetty component can share the same port
across bundles.



On Sat, Dec 21, 2013 at 1:52 AM, samslara <sa...@yahoo.com> wrote:
> It was my understanding of the contrary.  I'm currently using servicemix
> where there are 20+ bundles each with a camel context and each of those with
> routes starting with a jetty consumer (eg: <from
> uri="jetty:http:0.0.0.0:8080/..." />).  We haven't had any problems with
> each of these camel routes listening on the common 8080 port.  In fact each
> of these routes are differentiated by a different context path (eg:
> jetty:http://0.0.0.0:8080/a vs jetty:http://0.0.0.0:8080/b) and it all seems
> to route correctly.  Also with current versions of servicemix there is a
> commons configuration of jetty.xml which I believed to be the configuration
> of the common jetty server for all inbound <from uri="jetty:..." />
> requests.
> I thought the jetty Camel Component is able to do this via a single jetty
> server that is started up on servicemix and where each bundle (via the jetty
> Camel Component) registers a CamelContinuationServlet.  Am I wrong with any
> of this?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068p5745145.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Camel Jetty component and overlapping urls when a consumer

Posted by samslara <sa...@yahoo.com>.
It was my understanding of the contrary.  I'm currently using servicemix
where there are 20+ bundles each with a camel context and each of those with
routes starting with a jetty consumer (eg: <from
uri="jetty:http:0.0.0.0:8080/..." />).  We haven't had any problems with
each of these camel routes listening on the common 8080 port.  In fact each
of these routes are differentiated by a different context path (eg:
jetty:http://0.0.0.0:8080/a vs jetty:http://0.0.0.0:8080/b) and it all seems
to route correctly.  Also with current versions of servicemix there is a
commons configuration of jetty.xml which I believed to be the configuration
of the common jetty server for all inbound <from uri="jetty:..." />
requests.
I thought the jetty Camel Component is able to do this via a single jetty
server that is started up on servicemix and where each bundle (via the jetty
Camel Component) registers a CamelContinuationServlet.  Am I wrong with any
of this?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068p5745145.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty component and overlapping urls when a consumer

Posted by Willem Jiang <wi...@gmail.com>.
Current Camel Jetty component doesn’t support to share the Jetty component across bundle.
So I think if you put two bundles which use the same port into OSGi container, you will Socket bind error.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On December 20, 2013 at 4:17:09 AM, samslara (samslara@yahoo.com) wrote:
>  
> Hello,
> I have a question about the behavior of the jetty component when  
> in an
> OSGi environment (such as in ServiceMix). If I have two bundles  
> each with a
> camel context where one has a route such as:
>  
>  
> ...
>  
> and the other has a route such as:
>  
>  
> ...
>  
> and I call the container with
>  
> http://:8080/application1/a/b/c
>  
> Because of the overlapping url but with the second route being  
> more specific
> will this request go to the 2nd route, the 1st route, randomly  
> to either or
> will something else occur?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.  
>  


Re: Camel Jetty component and overlapping urls when a consumer

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Dec 21, 2013 at 9:48 PM, samslara <sa...@yahoo.com> wrote:
> I'm sorry you're right.  Our 20+ routes do have matchOnUriPrefix such as:
> <from uri="jetty:http://0.0.0.0:8080/...?matchUriOnPrefix=true" />
>
> In my original scenario but with this additional change what would happen?
>

Dont ask us. Ask the computer instead (eg try it out and see what happens)

> eg:
> route1:
> <from uri="jetty:http://0.0.0.0:8080/?matchOnUriPrefix=true"/>
> ...
>
> route2:
> <from uri="jetty:http://0.0.0.0:8080/application1?matchOnUriPrefix=true"/>
> ...
>
> request:
> http://<myip>:8080/application1/a/b/c
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068p5745161.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: Camel Jetty component and overlapping urls when a consumer

Posted by samslara <sa...@yahoo.com>.
I'm sorry you're right.  Our 20+ routes do have matchOnUriPrefix such as:
<from uri="jetty:http://0.0.0.0:8080/...?matchUriOnPrefix=true" />

In my original scenario but with this additional change what would happen?

eg:
route1:
<from uri="jetty:http://0.0.0.0:8080/?matchOnUriPrefix=true"/>
...

route2:
<from uri="jetty:http://0.0.0.0:8080/application1?matchOnUriPrefix=true"/>
...

request:
http://<myip>:8080/application1/a/b/c





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068p5745161.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty component and overlapping urls when a consumer

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 19, 2013 at 9:16 PM, samslara <sa...@yahoo.com> wrote:
> Hello,
>   I have a question about the behavior of the jetty component when in an
> OSGi environment (such as in ServiceMix).  If I have two bundles each with a
> camel context where one has a route such as:
>
> <from uri="jetty:http://0.0.0.0:8080/"/>
> ...
>
> and the other has a route such as:
>
> <from uri="jetty:http://0.0.0.0:8080/application1"/>
> ...
>
> and I call the container with
>
> http://<myip>:8080/application1/a/b/c
>
> Because of the overlapping url but with the second route being more specific
> will this request go to the 2nd route, the 1st route, randomly to either or
> will something else occur?
>

The urls is not overlapping, the 1st is only matched if a client connects to /
And the 2nd is only matched when you hit /application1.

You need to use matchOnUriPrefix to allow matching on wildcards, see
more details at
http://camel.apache.org/jetty



>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io