You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jack atwork <jr...@gmail.com> on 2014/11/04 12:12:17 UTC

Re: Configuring a servlet with camel-jetty

Hi Willem,

Can you provide any more information about this? Do you know if there is a
way to configure servlets using camel-jetty or is it simply not possible?
I'd really appreciate any insight you have into this.

Thanks,

Jack

On 31 October 2014 11:02, jack atwork <jr...@gmail.com> wrote:

> Thanks for the reply!
>
> I'm using the rest-dsl with camel-jetty and trying to integrate this with
> the camel-swagger to provide the api docs. Camel-swagger only provides a
> servlet. So my hope was to reuse camel-jetty to expose this servlet.
>
> Do you know if it is possible to register servlets with the camel-jetty
> component using another method?
>
> Thanks,
>
> Jack
>
> On 31 October 2014 01:15, Willem Jiang <wi...@gmail.com> wrote:
>
>> Can you explain why you need a setup a servlet for the camel-jetty
>> component?
>> As camel-jetty setup the ServletContextHandler by itself, it doesn’t
>> support you to do it that way.
>>
>> --
>> Willem Jiang
>>
>> Red Hat, Inc.
>> Web: http://www.redhat.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.iteye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>>
>>
>>
>> On October 30, 2014 at 7:12:33 PM, jack atwork (jrmpatwork@gmail.com)
>> wrote:
>> > It's contributed via spring. I can see this part is fine because if I
>> > misconfigure the id with something like 'MyUnregisteredContextHandler'
>> then
>> > I get a NoSuchBeanException when the camelContext is created.
>> >
>> > Does anybody know of any examples of setting up a servlet with
>> camel-jetty?
>> > If I add a filter to the handler I can see it gets executed on requests
>> but
>> > for some reason any servlets I add never get invoked.
>> >
>> > Jack
>> >
>> > On 29 October 2014 15:36, Andrew Block wrote:
>> >
>> > > Jack,
>> > >
>> > > Have you added the handler to the Camel Registry with the name
>> > > MyContextHandler? In your example, you are referencing the
>> > > “MyContetHandler” in your route, but never show it being added to the
>> Camel
>> > > registry.
>> > >
>> > > - Andy
>> > >
>> > > --
>> > > Andrew Block
>> > >
>> > >
>> > > On October 29, 2014 at 10:14:21 AM, jack atwork (jrmpatwork@gmail.com
>> )
>> > > wrote:
>> > >
>> > > apologies, hit send by a bit early!
>> > >
>> > > Hi,
>> > >
>> > > I'm trying to configure a servlet using the camel-jetty component but
>> I'm
>> > > struggling and hoping somebody might be able to point out what I'm
>> doing
>> > > wrong.
>> > >
>> > > I expected to be able to register a new Handler and reference it in
>> the
>> > > endpoint uri.
>> > >
>> > > ServletContextHandler handler = new ServletContextHandler();
>> > > handler.addServlet(new ServletHolder(myServlet), "/*");
>> > >
>> > > Then adding a route to my routeBuilder:
>> > >
>> > > from("jetty:
>> > >
>> http://localhost:8080/?matchOnUriPrefix=true&handlers=#MyContextHandler")
>> > > .to("log:foo");
>> > >
>> > > I can see my servlet gets initialised but it is never invoked on any
>> > > requests. Can anyone tell me what's missing?
>> > >
>> > > Thanks,
>> > >
>> > > Jack
>> > >
>> > >
>> > > On 29 October 2014 15:06, jack atwork wrote:
>> > >
>> > > > Hi,
>> > > >
>> > > > I'm trying to configure a servlet using the camel-jetty component
>> but
>> > > I'm
>> > > > struggling and hoping somebody might be able to point out what I'm
>> doing
>> > > > wrong.
>> > > >
>> > > > I expected to be able to register a new Handler and reference it in
>> the
>> > > > endpoint uri .
>> > > >
>> > > > ServletContextHandler handler = new ServletContextHandler();
>> > > > handler.addServlet(new ServletHolder(myServlet), "/*");
>> > > >
>> > > > Then adding a route to my routeBuilder:
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > >
>> > >
>> >
>>
>>
>

Re: Configuring a servlet with camel-jetty

Posted by Reji Mathews <co...@gmail.com>.
I guess for Jetty, internally there must be a servlet acting at back. Or
probably set some option to get it up and running.

Just got some clue from http://camel.apache.org/jetty.html . Alternatively
http://camel.apache.org/servlet.html can help too.

Reji

On Tue, Nov 4, 2014 at 4:42 PM, jack atwork <jr...@gmail.com> wrote:

> Hi Willem,
>
> Can you provide any more information about this? Do you know if there is a
> way to configure servlets using camel-jetty or is it simply not possible?
> I'd really appreciate any insight you have into this.
>
> Thanks,
>
> Jack
>
> On 31 October 2014 11:02, jack atwork <jr...@gmail.com> wrote:
>
> > Thanks for the reply!
> >
> > I'm using the rest-dsl with camel-jetty and trying to integrate this with
> > the camel-swagger to provide the api docs. Camel-swagger only provides a
> > servlet. So my hope was to reuse camel-jetty to expose this servlet.
> >
> > Do you know if it is possible to register servlets with the camel-jetty
> > component using another method?
> >
> > Thanks,
> >
> > Jack
> >
> > On 31 October 2014 01:15, Willem Jiang <wi...@gmail.com> wrote:
> >
> >> Can you explain why you need a setup a servlet for the camel-jetty
> >> component?
> >> As camel-jetty setup the ServletContextHandler by itself, it doesn’t
> >> support you to do it that way.
> >>
> >> --
> >> Willem Jiang
> >>
> >> Red Hat, Inc.
> >> Web: http://www.redhat.com
> >> Blog: http://willemjiang.blogspot.com (English)
> >> http://jnn.iteye.com (Chinese)
> >> Twitter: willemjiang
> >> Weibo: 姜宁willem
> >>
> >>
> >>
> >> On October 30, 2014 at 7:12:33 PM, jack atwork (jrmpatwork@gmail.com)
> >> wrote:
> >> > It's contributed via spring. I can see this part is fine because if I
> >> > misconfigure the id with something like 'MyUnregisteredContextHandler'
> >> then
> >> > I get a NoSuchBeanException when the camelContext is created.
> >> >
> >> > Does anybody know of any examples of setting up a servlet with
> >> camel-jetty?
> >> > If I add a filter to the handler I can see it gets executed on
> requests
> >> but
> >> > for some reason any servlets I add never get invoked.
> >> >
> >> > Jack
> >> >
> >> > On 29 October 2014 15:36, Andrew Block wrote:
> >> >
> >> > > Jack,
> >> > >
> >> > > Have you added the handler to the Camel Registry with the name
> >> > > MyContextHandler? In your example, you are referencing the
> >> > > “MyContetHandler” in your route, but never show it being added to
> the
> >> Camel
> >> > > registry.
> >> > >
> >> > > - Andy
> >> > >
> >> > > --
> >> > > Andrew Block
> >> > >
> >> > >
> >> > > On October 29, 2014 at 10:14:21 AM, jack atwork (
> jrmpatwork@gmail.com
> >> )
> >> > > wrote:
> >> > >
> >> > > apologies, hit send by a bit early!
> >> > >
> >> > > Hi,
> >> > >
> >> > > I'm trying to configure a servlet using the camel-jetty component
> but
> >> I'm
> >> > > struggling and hoping somebody might be able to point out what I'm
> >> doing
> >> > > wrong.
> >> > >
> >> > > I expected to be able to register a new Handler and reference it in
> >> the
> >> > > endpoint uri.
> >> > >
> >> > > ServletContextHandler handler = new ServletContextHandler();
> >> > > handler.addServlet(new ServletHolder(myServlet), "/*");
> >> > >
> >> > > Then adding a route to my routeBuilder:
> >> > >
> >> > > from("jetty:
> >> > >
> >> http://localhost:8080/?matchOnUriPrefix=true&handlers=#MyContextHandler
> ")
> >> > > .to("log:foo");
> >> > >
> >> > > I can see my servlet gets initialised but it is never invoked on any
> >> > > requests. Can anyone tell me what's missing?
> >> > >
> >> > > Thanks,
> >> > >
> >> > > Jack
> >> > >
> >> > >
> >> > > On 29 October 2014 15:06, jack atwork wrote:
> >> > >
> >> > > > Hi,
> >> > > >
> >> > > > I'm trying to configure a servlet using the camel-jetty component
> >> but
> >> > > I'm
> >> > > > struggling and hoping somebody might be able to point out what I'm
> >> doing
> >> > > > wrong.
> >> > > >
> >> > > > I expected to be able to register a new Handler and reference it
> in
> >> the
> >> > > > endpoint uri .
> >> > > >
> >> > > > ServletContextHandler handler = new ServletContextHandler();
> >> > > > handler.addServlet(new ServletHolder(myServlet), "/*");
> >> > > >
> >> > > > Then adding a route to my routeBuilder:
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > >
> >> > >
> >> >
> >>
> >>
> >
>