Thank you a lot, it works!
Here my simple test code:
...
CamelContext camelContext = new DefaultCamelContext();
final Processor proc = new Processor() {
@Override
public void process(Exchange ex) throws Exception {
ex.getOut().setBody("<html><body>Salut !</body></html>");
}
};
camelContext.addRoutes(new RouteBuilder() {
public void configure() {
from("jetty:http://localhost:8081/test").process(proc);
}
});
camelContext.start();
...
When navigating to the URL http://localhost:8081/test, with an Internet
navigator, you shoud get a page with the word "Salut !" (it's french).
We see that with Camel you can implement easily web services!
Note: you can also deploy web services on Java Standard Edition 6
applications with JAX-WS, using POJO and annotations.
Thank you again.
Soon, I will put some technical articles on my web site to introduce Camel:
http://www.odelia-technologies.com/
Bertrand.
Hiram Chirino wrote:
>
> Hey.. The fix is now committed.
>
> I opened issue
> https://issues.apache.org/activemq/browse/CAMEL-158
> To track the change.
>
> I also added a test case here:
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
>
> That now shows that the output is indeed getting returned in the HTTP
> response.
>
>
> On 9/26/07, Hiram Chirino <[EMAIL PROTECTED]> wrote:
>> I have verified that we have a bug. I've almost got the fix done.
>> I'll post back once it's committed.
>>
>> On 9/26/07, bgoetzmann <[EMAIL PROTECTED]> wrote:
>> >
>> > My Processor instance, implementing the process method simply do this:
>> >
>> > ex.getOut().setBody("<html><body>Salut !</body></html>");
>> >
>> > But perhaps I have to type ex with HttpExchange et try to work with the
>> > HttpResponse?
>> >
>> > However in IE7, using the URL http://localhost:8080/test, process is
>> well
>> > invoked, and IE7 display a valid HTML page but empty.
>> >
>> > Any idea?
>> >
>> > Thank you.
>> >
>> >
>> > Hiram Chirino wrote:
>> > >
>> > > That should be all you need to do. If it's not working perhaps it's
>> a
>> > > bug in the jetty component.
>> > >
>> > > I'll throw a quick test case to together to verify.
>> > >
>> > > On 9/26/07, bgoetzmann <[EMAIL PROTECTED]> wrote:
>> > >>
>> > >> I'm new in Camel, and to have worked with ServiceMix I understand I
>> have
>> > >> to
>> > >> fill an out message for the caller as in a MEP of type InOut.
>> > >>
>> > >> So, I my route I use something like:
>> > >>
>> > >> from("jetty:http://localhost:8080/test).process(proc).?
>> > >>
>> > >> where proc implements the Processor interface and I set the out
>> message
>> > >> in
>> > >> the Processor.process method. But how can I complete the route in
>> order
>> > >> my
>> > >> out message be sent to the caller?
>> > >>
>> > >> Thank you a lot.
>> > >>
>> > >> Bertrand.
>> > >>
>> > >>
>> > >>
>> > >> Hiram Chirino wrote:
>> > >> >
>> > >> > It will reply with whatever is in the exchange.out message field
>> when
>> > >> > the pipeline is done getting processed.
>> > >> >
>> > >> > On 9/25/07, bgoetzmann <[EMAIL PROTECTED]> wrote:
>> > >> >>
>> > >> >> Hello,
>> > >> >>
>> > >> >> I think it's a simple question! I'm using a route with something
>> like:
>> > >> >>
>> > >> >> from("jetty:http://localhost:8080/test)...
>> > >> >>
>> > >> >> in order to receive an HTTP request from an Internet Navigator
>> for
>> > >> >> example.
>> > >> >>
>> > >> >> With Camel how can I respond to the caller? By using an Endpoint
>> > >> instance
>> > >> >> like this:
>> > >> >>
>> > >> >> from(ep). ... .to(ep)?
>> > >> >>
>> > >> >>
>> > >> >> Thank you.
>> > >> >>
>> > >> >> Bertrand.
>> > >> >> --
>> > >> >> View this message in context:
>> > >> >>
>> > >>
>> http://www.nabble.com/Respond-to-an-HTTP-request-received-via-a-jetty-URI-tf4517024s22882.html#a12884514
>> > >> >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> > >> >>
>> > >> >>
>> > >> >
>> > >> >
>> > >> > --
>> > >> > Regards,
>> > >> > Hiram
>> > >> >
>> > >> > Blog: http://hiramchirino.com
>> > >> >
>> > >> >
>> > >>
>> > >> --
>> > >> View this message in context:
>> > >>
>> http://www.nabble.com/Respond-to-an-HTTP-request-received-via-a-jetty-URI-tf4517024s22882.html#a12896292
>> > >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> > >>
>> > >>
>> > >
>> > >
>> > > --
>> > > Regards,
>> > > Hiram
>> > >
>> > > Blog: http://hiramchirino.com
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/Respond-to-an-HTTP-request-received-via-a-jetty-URI-tf4517024s22882.html#a12903191
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>> --
>> Regards,
>> Hiram
>>
>> Blog: http://hiramchirino.com
>>
>
>
> --
> Regards,
> Hiram
>
> Blog: http://hiramchirino.com
>
>
--
View this message in context:
http://www.nabble.com/Respond-to-an-HTTP-request-received-via-a-jetty-URI-tf4517024s22882.html#a12909392
Sent from the Camel - Users mailing list archive at Nabble.com.