You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Christian Schneider <ch...@die-schneider.net> on 2011/12/05 14:07:06 UTC

[Discussion] Unify prefixes http, jetty, servlet?

Some time ago I did some unification in CXF to make it easier for users 
to configure the different http transports.  I would like to do a 
similar thing for camel.

Currently we have three different http components:

camel-http : Only producer
camel-jetty : Only consumer with embedded jetty
camel-servlet : Only consumer with servlet from servlet container or 
OSGi Server

This means people have to use three different prefixes.

I would like to change this to only use the prefix http.

Producer:
to("http://myserver/mypath")

Servlet consumer:
from("/myservlet/mypath")

Jetty consumer:
from("http://myserver:myport/mypath")

The idea is to select the Endpoint type based on the URI and endpoint 
type but to hide this from the user.

Christian

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: [Discussion] Unify prefixes http, jetty, servlet?

Posted by bvahdat <ba...@swissonline.ch>.
Hi Christian,

I assume in Apache Camel we deal with URIs in general and not URLs in
particular, so that the following line of code

        new URI("jetty:http://camel.com:1099/service");

doesn't throw any URISyntaxException on my box. As the scheme is "jetty" &
the scheme-specific part of it is "http://camel.com:1099/service".

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/Discussion-Unify-prefixes-http-jetty-servlet-tp5048808p5049163.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: [Discussion] Unify prefixes http, jetty, servlet?

Posted by Christian Schneider <ch...@die-schneider.net>.
Sorry the url without prefix was wrong of course. It should rather read:
from("http:///foo/bar")

Not sure if this is correct. The idea is to write a http: url without a 
server and port name. This would then trigger the usage of the servlet 
component instead of the jetty component.

We should still have the other prefixes but why not allow to configure 
consumers using http:... it would match nicely to the concept of 
convention over configuration.

Basically all new camel users stumble over the problem that http: is 
only for consumers and that for jetty you have to write jetty:http:// 
which also looks quite strange. I am not sure if jetty:http: is a valid 
URL at all.

Christian

Am 05.12.2011 14:41, schrieb Claus Ibsen:
>
> This is not a good idea.
>
> We have 5 http component with Camel
> - http
> - http4
> - jetty
> - servlet
> - ahc
>
> Some supports producer only, consumer only, or both
>
>
> Also this would deviate from how endpoints and components works in Camel.
> The scheme always refer to the component name. So its easy to remember.
>
>
> For example in you example
>
> from("/foo/bar")
>
> What does this refer to? You say its a servlet. But for others this
> could just as well look like a file path.
>
> So having to explicit define the component makes it all clear to the reader
> from("servlet:/foo/bar")
> from("file:/foo/bar")
>
>
> Also when you must define a component name, then there will be no
> clashes in the future, as the component name is unique.
>
>
>
>
>
>> Christian
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> Talend Application Integration Division http://www.talend.com
>>
>
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: [Discussion] Unify prefixes http, jetty, servlet?

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Dec 5, 2011 at 2:07 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> Some time ago I did some unification in CXF to make it easier for users to
> configure the different http transports.  I would like to do a similar thing
> for camel.
>
> Currently we have three different http components:
>
> camel-http : Only producer
> camel-jetty : Only consumer with embedded jetty
> camel-servlet : Only consumer with servlet from servlet container or OSGi
> Server
>
> This means people have to use three different prefixes.
>
> I would like to change this to only use the prefix http.
>
> Producer:
> to("http://myserver/mypath")
>
> Servlet consumer:
> from("/myservlet/mypath")
>
> Jetty consumer:
> from("http://myserver:myport/mypath")
>
> The idea is to select the Endpoint type based on the URI and endpoint type
> but to hide this from the user.
>

This is not a good idea.

We have 5 http component with Camel
- http
- http4
- jetty
- servlet
- ahc

Some supports producer only, consumer only, or both


Also this would deviate from how endpoints and components works in Camel.
The scheme always refer to the component name. So its easy to remember.


For example in you example

from("/foo/bar")

What does this refer to? You say its a servlet. But for others this
could just as well look like a file path.

So having to explicit define the component makes it all clear to the reader
from("servlet:/foo/bar")
from("file:/foo/bar")


Also when you must define a component name, then there will be no
clashes in the future, as the component name is unique.





> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: [Discussion] Unify prefixes http, jetty, servlet?

Posted by Willem Jiang <wi...@gmail.com>.
Just a quick note for the camel-jetty component, it has consumer and  a 
producer which leverage the jetty client API to send the request 
asynchronously.


On Mon Dec  5 21:07:06 2011, Christian Schneider wrote:
> Some time ago I did some unification in CXF to make it easier for
> users to configure the different http transports. I would like to do a
> similar thing for camel.
>
> Currently we have three different http components:
>
> camel-http : Only producer
> camel-jetty : Only consumer with embedded jetty
> camel-servlet : Only consumer with servlet from servlet container or
> OSGi Server
>
> This means people have to use three different prefixes.
>
> I would like to change this to only use the prefix http.
>
> Producer:
> to("http://myserver/mypath")
>
> Servlet consumer:
> from("/myservlet/mypath")
>
> Jetty consumer:
> from("http://myserver:myport/mypath")
>
> The idea is to select the Endpoint type based on the URI and endpoint
> type but to hide this from the user.
>
> Christian
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: [Discussion] Unify prefixes http, jetty, servlet?

Posted by Richard Kettelerij <ri...@gmail.com>.
Hi Christian,

I welcome every suggestion to simplify Camel but I'm not sure what benefit
this proposal will bring (considering the costs of maintaining backwards
compatibility).

More importantly I think you run the risk of introducing a "leaky
abstraction"(http://en.wikipedia.org/wiki/Leaky_abstraction). This proposal
hides the servlet and jetty concepts from the end user. Is that what we
really what? The user should still be aware he is using servlet/jetty
underneath since camel-servlet/camel-jetty need be available on the
classpath to get it all working. Also one should understand the
implications of servlet (i.e. the need to run Camel in a container) or
jetty to some extend when building integration solutions.

Regards,
Richard

On Mon, Dec 5, 2011 at 2:07 PM, Christian Schneider <chris@die-schneider.net
> wrote:

> Some time ago I did some unification in CXF to make it easier for users to
> configure the different http transports.  I would like to do a similar
> thing for camel.
>
> Currently we have three different http components:
>
> camel-http : Only producer
> camel-jetty : Only consumer with embedded jetty
> camel-servlet : Only consumer with servlet from servlet container or OSGi
> Server
>
> This means people have to use three different prefixes.
>
> I would like to change this to only use the prefix http.
>
> Producer:
> to("http://myserver/mypath")
>
> Servlet consumer:
> from("/myservlet/mypath")
>
> Jetty consumer:
> from("http://myserver:myport/**mypath")
>
> The idea is to select the Endpoint type based on the URI and endpoint type
> but to hide this from the user.
>
> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>