You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Pieter Martin <pi...@gmail.com> on 2011/07/09 10:28:16 UTC

RE: codi and webservices

Hi,

Is there any support for having a webservice request happening inside a 
cdi/codi world. In particular I am using apache cxf in jetty, starting 
up the CXFNonSpringServlet which does the magic. So I imagine somehow 
this servlet's requests needs to be wrapped in a codi life cycle similar 
to how faces works.

Is this possible?

Thanks
Pieter

Re: codi and webservices

Posted by Pieter Martin <pi...@gmail.com>.
Hi,

Thanks for the response, I'll have a look at OpenEJB.
To be honest we have come to a Jetty CODI/Cdi world from a jboss world 
precisely to get away from ejb's and ee in general as we are perpetually 
spending time understanding frameworks and semantics. That said we have 
had much success with some of the services provided by ee.

Thanks
Pieter

On 10/07/2011 02:38, David Blevins wrote:
> On Jul 9, 2011, at 12:55 PM, Mark Struberg wrote:
>
>> You might try using OpenWebBeans + OpenEJB. Those 2 play really well together, and EJB contains MDB. Not sure though if the MDB impl in OpenEJB already works together with CDI. David, I guess you know more than I about that, mind to share your thoughts?
> Overall SessionBean integration is now pretty good.  This includes @WebService beans which are either an @Stateless or @Singleton.  We use CXF for that.  Jean-Louis and Romain have been hacking on extending the existing CXF integration which currently covers JAX-WS to also cover JAX-RS.  When not in Tomcat, we default to using Jetty as the HTTP impl.  That all works in plain Java SE or you can boot it as a standalone server -- whatever is easiest for you.
>
> MDB-wise things might be a little behind.  We're definitely now using OWB to construct MDBs -- as of two weeks ago we no longer use our own code for instantiating beans and instead use the OWB code so things can get CDI constructor injection.  All part of the plans to make things super consistent and seamless.  So @Inject constructors should definitely work.
>
> Field and method injection might still be missing.  I'm pretty sure it is missing, but wouldn't be hard to add.
>
> MDB Interceptors should work -- we use the same interceptor code for everything.  MDB Decorators might work, but I would have to check.
>
> All this work is still ongoing, so if there are feature requests, now is the prime-time to get them in.  Always much harder when you're working on something unrelated and have to shift-gears.
>
> Let me know what you want and I'll add it :)
>
>
>
> -David
>
>
>> --- On Sat, 7/9/11, Pieter Martin<pi...@gmail.com>  wrote:
>>
>>> From: Pieter Martin<pi...@gmail.com>
>>> Subject: Re: codi and webservices
>>> To: "MyFaces Discussion"<us...@myfaces.apache.org>
>>> Date: Saturday, July 9, 2011, 3:24 PM
>>> Thanks, yes I am using OpenWebBeans
>>> and happily so. I tried the
>>> BeanManagerProvider and things are working well.
>>>
>>> I reckon I will have the same issue with regards to jms,
>>> when I get
>>> round to putting hornetq or ApacheMq into Jetty?
>>>
>>> Thanks
>>> Pieter
>>>
>>>
>>> On 09/07/2011 11:32, Mark Struberg wrote:
>>>> Hi Pieter!
>>>>
>>>> This is more a CDI container question than a CODI
>>> question :)
>>>>     From the stacktrace you posted in an older post
>>> I saw that you are using Apache OpenWebBeans, right? good
>>> decision btw :D
>>>> Since I know a little bit about OWB, I'll try to
>>> explain ;)
>>>> Basically any Servlet inside your webapp already
>>> should have all things correctly setup. If you are
>>> interested in the details then check OWBs
>>> WebBeansConfigurationListener. If you are using
>>> CXFNonSpringServlet then the Servlet itself will not be
>>> created by CDI, so the servlet instance itself is not a
>>> CDI-managed object (Maybe there is some CXFCdiServlet in the
>>> future...) This basically means that any @Inject inside this
>>> class will not get injected.
>>>> In this case you can use CODIs BeanManagerProvider to
>>> get access to a CDI managed bean manually.
>>>> I use this trick with an old JAX-RS stack as well.
>>>>
>>>> hope this helps!
>>>>
>>>> LieGrue,
>>>> strub
>>>>
>>>>
>>>> --- On Sat, 7/9/11, Pieter Martin<pi...@gmail.com>
>>> wrote:
>>>>> From: Pieter Martin<pi...@gmail.com>
>>>>> Subject: RE: codi and webservices
>>>>> To: "MyFaces Discussion"<us...@myfaces.apache.org>
>>>>> Date: Saturday, July 9, 2011, 8:28 AM
>>>>> Hi,
>>>>>
>>>>> Is there any support for having a webservice
>>> request
>>>>> happening inside a cdi/codi world. In particular I
>>> am using
>>>>> apache cxf in jetty, starting up the
>>> CXFNonSpringServlet
>>>>> which does the magic. So I imagine somehow this
>>> servlet's
>>>>> requests needs to be wrapped in a codi life cycle
>>> similar to
>>>>> how faces works.
>>>>>
>>>>> Is this possible?
>>>>>
>>>>> Thanks
>>>>> Pieter
>>>>>
>>>


Re: codi and webservices

Posted by David Blevins <da...@visi.com>.
On Jul 9, 2011, at 12:55 PM, Mark Struberg wrote:

> You might try using OpenWebBeans + OpenEJB. Those 2 play really well together, and EJB contains MDB. Not sure though if the MDB impl in OpenEJB already works together with CDI. David, I guess you know more than I about that, mind to share your thoughts?

Overall SessionBean integration is now pretty good.  This includes @WebService beans which are either an @Stateless or @Singleton.  We use CXF for that.  Jean-Louis and Romain have been hacking on extending the existing CXF integration which currently covers JAX-WS to also cover JAX-RS.  When not in Tomcat, we default to using Jetty as the HTTP impl.  That all works in plain Java SE or you can boot it as a standalone server -- whatever is easiest for you.

MDB-wise things might be a little behind.  We're definitely now using OWB to construct MDBs -- as of two weeks ago we no longer use our own code for instantiating beans and instead use the OWB code so things can get CDI constructor injection.  All part of the plans to make things super consistent and seamless.  So @Inject constructors should definitely work.

Field and method injection might still be missing.  I'm pretty sure it is missing, but wouldn't be hard to add.

MDB Interceptors should work -- we use the same interceptor code for everything.  MDB Decorators might work, but I would have to check.

All this work is still ongoing, so if there are feature requests, now is the prime-time to get them in.  Always much harder when you're working on something unrelated and have to shift-gears.

Let me know what you want and I'll add it :)



-David


> --- On Sat, 7/9/11, Pieter Martin <pi...@gmail.com> wrote:
> 
>> From: Pieter Martin <pi...@gmail.com>
>> Subject: Re: codi and webservices
>> To: "MyFaces Discussion" <us...@myfaces.apache.org>
>> Date: Saturday, July 9, 2011, 3:24 PM
>> Thanks, yes I am using OpenWebBeans
>> and happily so. I tried the 
>> BeanManagerProvider and things are working well.
>> 
>> I reckon I will have the same issue with regards to jms,
>> when I get 
>> round to putting hornetq or ApacheMq into Jetty?
>> 
>> Thanks
>> Pieter
>> 
>> 
>> On 09/07/2011 11:32, Mark Struberg wrote:
>>> Hi Pieter!
>>> 
>>> This is more a CDI container question than a CODI
>> question :)
>>>   From the stacktrace you posted in an older post
>> I saw that you are using Apache OpenWebBeans, right? good
>> decision btw :D
>>> 
>>> Since I know a little bit about OWB, I'll try to
>> explain ;)
>>> 
>>> Basically any Servlet inside your webapp already
>> should have all things correctly setup. If you are
>> interested in the details then check OWBs
>> WebBeansConfigurationListener. If you are using
>> CXFNonSpringServlet then the Servlet itself will not be
>> created by CDI, so the servlet instance itself is not a
>> CDI-managed object (Maybe there is some CXFCdiServlet in the
>> future...) This basically means that any @Inject inside this
>> class will not get injected.
>>> 
>>> In this case you can use CODIs BeanManagerProvider to
>> get access to a CDI managed bean manually.
>>> I use this trick with an old JAX-RS stack as well.
>>> 
>>> hope this helps!
>>> 
>>> LieGrue,
>>> strub
>>> 
>>> 
>>> --- On Sat, 7/9/11, Pieter Martin<pi...@gmail.com> 
>> wrote:
>>> 
>>>> From: Pieter Martin<pi...@gmail.com>
>>>> Subject: RE: codi and webservices
>>>> To: "MyFaces Discussion"<us...@myfaces.apache.org>
>>>> Date: Saturday, July 9, 2011, 8:28 AM
>>>> Hi,
>>>> 
>>>> Is there any support for having a webservice
>> request
>>>> happening inside a cdi/codi world. In particular I
>> am using
>>>> apache cxf in jetty, starting up the
>> CXFNonSpringServlet
>>>> which does the magic. So I imagine somehow this
>> servlet's
>>>> requests needs to be wrapped in a codi life cycle
>> similar to
>>>> how faces works.
>>>> 
>>>> Is this possible?
>>>> 
>>>> Thanks
>>>> Pieter
>>>> 
>> 
>> 
> 


Re: codi and webservices

Posted by Mark Struberg <st...@yahoo.de>.
You might try using OpenWebBeans + OpenEJB. Those 2 play really well together, and EJB contains MDB. Not sure though if the MDB impl in OpenEJB already works together with CDI. David, I guess you know more than I about that, mind to share your thoughts?

txs and LieGrue,
strub

--- On Sat, 7/9/11, Pieter Martin <pi...@gmail.com> wrote:

> From: Pieter Martin <pi...@gmail.com>
> Subject: Re: codi and webservices
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Date: Saturday, July 9, 2011, 3:24 PM
> Thanks, yes I am using OpenWebBeans
> and happily so. I tried the 
> BeanManagerProvider and things are working well.
> 
> I reckon I will have the same issue with regards to jms,
> when I get 
> round to putting hornetq or ApacheMq into Jetty?
> 
> Thanks
> Pieter
> 
> 
> On 09/07/2011 11:32, Mark Struberg wrote:
> > Hi Pieter!
> >
> > This is more a CDI container question than a CODI
> question :)
> >  From the stacktrace you posted in an older post
> I saw that you are using Apache OpenWebBeans, right? good
> decision btw :D
> >
> > Since I know a little bit about OWB, I'll try to
> explain ;)
> >
> > Basically any Servlet inside your webapp already
> should have all things correctly setup. If you are
> interested in the details then check OWBs
> WebBeansConfigurationListener. If you are using
> CXFNonSpringServlet then the Servlet itself will not be
> created by CDI, so the servlet instance itself is not a
> CDI-managed object (Maybe there is some CXFCdiServlet in the
> future...) This basically means that any @Inject inside this
> class will not get injected.
> >
> > In this case you can use CODIs BeanManagerProvider to
> get access to a CDI managed bean manually.
> > I use this trick with an old JAX-RS stack as well.
> >
> > hope this helps!
> >
> > LieGrue,
> > strub
> >
> >
> > --- On Sat, 7/9/11, Pieter Martin<pi...@gmail.com> 
> wrote:
> >
> >> From: Pieter Martin<pi...@gmail.com>
> >> Subject: RE: codi and webservices
> >> To: "MyFaces Discussion"<us...@myfaces.apache.org>
> >> Date: Saturday, July 9, 2011, 8:28 AM
> >> Hi,
> >>
> >> Is there any support for having a webservice
> request
> >> happening inside a cdi/codi world. In particular I
> am using
> >> apache cxf in jetty, starting up the
> CXFNonSpringServlet
> >> which does the magic. So I imagine somehow this
> servlet's
> >> requests needs to be wrapped in a codi life cycle
> similar to
> >> how faces works.
> >>
> >> Is this possible?
> >>
> >> Thanks
> >> Pieter
> >>
> 
> 

Re: codi and webservices

Posted by Pieter Martin <pi...@gmail.com>.
Thanks, yes I am using OpenWebBeans and happily so. I tried the 
BeanManagerProvider and things are working well.

I reckon I will have the same issue with regards to jms, when I get 
round to putting hornetq or ApacheMq into Jetty?

Thanks
Pieter


On 09/07/2011 11:32, Mark Struberg wrote:
> Hi Pieter!
>
> This is more a CDI container question than a CODI question :)
>  From the stacktrace you posted in an older post I saw that you are using Apache OpenWebBeans, right? good decision btw :D
>
> Since I know a little bit about OWB, I'll try to explain ;)
>
> Basically any Servlet inside your webapp already should have all things correctly setup. If you are interested in the details then check OWBs WebBeansConfigurationListener. If you are using CXFNonSpringServlet then the Servlet itself will not be created by CDI, so the servlet instance itself is not a CDI-managed object (Maybe there is some CXFCdiServlet in the future...) This basically means that any @Inject inside this class will not get injected.
>
> In this case you can use CODIs BeanManagerProvider to get access to a CDI managed bean manually.
> I use this trick with an old JAX-RS stack as well.
>
> hope this helps!
>
> LieGrue,
> strub
>
>
> --- On Sat, 7/9/11, Pieter Martin<pi...@gmail.com>  wrote:
>
>> From: Pieter Martin<pi...@gmail.com>
>> Subject: RE: codi and webservices
>> To: "MyFaces Discussion"<us...@myfaces.apache.org>
>> Date: Saturday, July 9, 2011, 8:28 AM
>> Hi,
>>
>> Is there any support for having a webservice request
>> happening inside a cdi/codi world. In particular I am using
>> apache cxf in jetty, starting up the CXFNonSpringServlet
>> which does the magic. So I imagine somehow this servlet's
>> requests needs to be wrapped in a codi life cycle similar to
>> how faces works.
>>
>> Is this possible?
>>
>> Thanks
>> Pieter
>>


RE: codi and webservices

Posted by Mark Struberg <st...@yahoo.de>.
Hi Pieter!

This is more a CDI container question than a CODI question :)
>From the stacktrace you posted in an older post I saw that you are using Apache OpenWebBeans, right? good decision btw :D  

Since I know a little bit about OWB, I'll try to explain ;)

Basically any Servlet inside your webapp already should have all things correctly setup. If you are interested in the details then check OWBs WebBeansConfigurationListener. If you are using CXFNonSpringServlet then the Servlet itself will not be created by CDI, so the servlet instance itself is not a CDI-managed object (Maybe there is some CXFCdiServlet in the future...) This basically means that any @Inject inside this class will not get injected.

In this case you can use CODIs BeanManagerProvider to get access to a CDI managed bean manually.
I use this trick with an old JAX-RS stack as well.

hope this helps!

LieGrue,
strub


--- On Sat, 7/9/11, Pieter Martin <pi...@gmail.com> wrote:

> From: Pieter Martin <pi...@gmail.com>
> Subject: RE: codi and webservices
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Date: Saturday, July 9, 2011, 8:28 AM
> Hi,
> 
> Is there any support for having a webservice request
> happening inside a cdi/codi world. In particular I am using
> apache cxf in jetty, starting up the CXFNonSpringServlet
> which does the magic. So I imagine somehow this servlet's
> requests needs to be wrapped in a codi life cycle similar to
> how faces works.
> 
> Is this possible?
> 
> Thanks
> Pieter
>