On 8/22/07, Nicky Sandhu <[EMAIL PROTECTED]> wrote:
> HttpComponent creates an embedded jetty server. This seems to be different
> from the stated aim of the component which is to represent http endpoints
> (not "host" them). Am I missing the point?

Thats an oversight really. We started the consumer side first; then
added the producer side. There's no real reason you should have to
start an embedded Jetty server if you are just using the client side
of HTTP.

I've just patched trunk to lazily create the Jetty server. Also you
could try using just the HttpComponent rather than the
HttpJettyComponent if you prefer (which never starts Jetty) to only
support client side HTTP


> Consuming external http resources is not possible as the
> createMethod(Exchange exchange) method in HttpProducer can never result in a
> return of GetMethod(uri).

>From reading the source again - it looks like a GetMethod is used,
unless the body of the Message can be converted to a valid
RequestEntity. Does this always generate POSTs for you?

Another option is to provide some default HTTP operation on the
endpoint as configuration; or as a header/property on the exchange
maybe?


> So going to back to the route I have to represent www.google.com as a
> endpoint and then consume from it, it should send back the contents of the
> get request to http://www.google.com. If I produce to it, it should be able
> send a post request to the url with the contents of the message... OR is
> that too restful and needs another component ?
>
> from("http://www.google.com";).to("direct:a")
>
> or is there some other component to achieve the above?

There's some confusion here between Camel's producer/consumer model
and HTTP GET/POST.

In Camel terms making a POST/GET on a http URI is using the producer
side. So you could do this today using the CamelTemplate for example.

Normally...

from(foo).to(bar)

basically means create a consumer of foo; then when it receives a
message send it on to bar for processing.

In this case we want to poll "http://www.google.com"; and send a
message to "direct:a"; so I guess this is another kind of HTTP
consumer; a polling http client.

Maybe we need to separate out the http-client component from the
servlet/server side? Another option is to use another component to do
the polling; something like...

from("timer:foo?period=5000").to("http://www.google.com";, "direct:a")

-- 
James
-------
http://macstrac.blogspot.com/

Reply via email to