|
From: Ian B. <ibu...@re...> - 2008-06-03 01:36:01
|
I am having some trouble connecting the dots. From the JAX-RS Spec it's clear that normally a new Resource Class is created for each request. I have convinced myself that the Resource Classes are something like endpoints or Struts actions; they get their model from the Provider and the scoping information from the injected annotation arguments. Coming from a Spring and web service background this is where I'd normally wire in a domain repositories and services. This doesn't seem to fit the model of having a new Resource Class per request. Can someone explain the right mental model for this? Thanks, Ian. |
|
From: Bill B. <bb...@re...> - 2008-06-03 05:20:23
|
Does this help shed some light? http://wiki.jboss.org/wiki/RESTeasySpringIntegration Ian Butcher wrote: > I am having some trouble connecting the dots. From the JAX-RS Spec > it's clear that normally a new Resource Class is created for each > request. I have convinced myself that the Resource Classes are > something like endpoints or Struts actions; they get their model from > the Provider and the scoping information from the injected annotation > arguments. > > Coming from a Spring and web service background this is where I'd > normally wire in a domain repositories and services. This doesn't > seem to fit the model of having a new Resource Class per request. Can > someone explain the right mental model for this? > > Thanks, > > Ian. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Bill B. <bb...@re...> - 2008-06-03 05:23:32
|
And one more thing. JAX-RS only has a simple default component model, instance per request. It does not mandate this model, nor does it disallow integration with EJBs, singelton objects, or Spring created beans. Bill Burke wrote: > Does this help shed some light? > > http://wiki.jboss.org/wiki/RESTeasySpringIntegration > > > > Ian Butcher wrote: >> I am having some trouble connecting the dots. From the JAX-RS Spec >> it's clear that normally a new Resource Class is created for each >> request. I have convinced myself that the Resource Classes are >> something like endpoints or Struts actions; they get their model from >> the Provider and the scoping information from the injected annotation >> arguments. >> >> Coming from a Spring and web service background this is where I'd >> normally wire in a domain repositories and services. This doesn't >> seem to fit the model of having a new Resource Class per request. Can >> someone explain the right mental model for this? >> >> Thanks, >> >> Ian. >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Resteasy-developers mailing list >> Res...@li... >> https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Ian B. <ibu...@re...> - 2008-06-03 14:41:25
|
Bill, Thanks for the responses. I have managed to hook up an application context fine. My question was, after I have an ApplicationContext how do I hook those into my Resource Classes? From the spec it looks like the authors are anticipating a JEE deployment. "JAX-RS root resource classes and providers are supplied with the same resource injection capabilities 22 as are provided for a Servlet instance running in a Java EE Web container. In particular the follow- 23 ing annotations may be used according to their individual semantics: @Resource, @Resources, @EJB, 24 @EJBs, @WebServiceRef, @WebServiceRefs, @PersistenceContext, @PersistenceContexts, 25 @PersistenceUnit and @PersistenceUnits. " So it looks like if I had a JEE 6 container I could wire in and EJB or web service. Is there something I can do now to wire in a Spring Bean? Thanks, Ian. On Jun 2, 2008, at 10:22 PM, Bill Burke wrote: > Does this help shed some light? > > http://wiki.jboss.org/wiki/RESTeasySpringIntegration > > > > Ian Butcher wrote: >> I am having some trouble connecting the dots. From the JAX-RS >> Spec it's clear that normally a new Resource Class is created for >> each request. I have convinced myself that the Resource Classes >> are something like endpoints or Struts actions; they get their >> model from the Provider and the scoping information from the >> injected annotation arguments. >> Coming from a Spring and web service background this is where I'd >> normally wire in a domain repositories and services. This >> doesn't seem to fit the model of having a new Resource Class per >> request. Can someone explain the right mental model for this? >> Thanks, >> Ian. >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Resteasy-developers mailing list >> Res...@li... >> https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com |
|
From: Bill B. <bb...@re...> - 2008-06-03 14:58:52
|
Nothing could we done with the default JAX-RS, standard model, to inject a Spring bean. You'd have to use the implementation's specific spring integration. If you look at Resteasy's Spring integration you'd see that it post-processes bean instances and registers them as singletons into the Resteasy Runtime. This means, you can configure your JAX-RS classes as Spring bean instances. You can configure them and reference other things however you want. For the default vanilla JAX-RS model, I do not support EE injection annotations and I'm not sure I will unless users really complain. You'd have to use JNDI lookups to pull in what you wanted if you were using that default model, OR, implement JAX-RS within an EJB. The WIKI talks about how we integrate with EJB. Hope this answers your questions. Ian Butcher wrote: > Bill, > > Thanks for the responses. I have managed to hook up an application > context fine. My question was, after I have an ApplicationContext how > do I hook those into my Resource Classes? From the spec it looks like > the authors are anticipating a JEE deployment. > > "JAX-RS root resource classes and providers are supplied with the same > resource injection capabilities 22 > as are provided for a Servlet instance running in a Java EE Web > container. In particular the follow- 23 > ing annotations may be used according to their individual semantics: > @Resource, @Resources, @EJB, 24 > @EJBs, @WebServiceRef, @WebServiceRefs, @PersistenceContext, > @PersistenceContexts, 25 > @PersistenceUnit and @PersistenceUnits. " > > So it looks like if I had a JEE 6 container I could wire in and EJB or > web service. Is there something I can do now to wire in a Spring Bean? > > Thanks, > > Ian. > > On Jun 2, 2008, at 10:22 PM, Bill Burke wrote: > >> Does this help shed some light? >> >> http://wiki.jboss.org/wiki/RESTeasySpringIntegration >> >> >> >> Ian Butcher wrote: >>> I am having some trouble connecting the dots. From the JAX-RS Spec >>> it's clear that normally a new Resource Class is created for each >>> request. I have convinced myself that the Resource Classes are >>> something like endpoints or Struts actions; they get their model >>> from the Provider and the scoping information from the injected >>> annotation arguments. >>> Coming from a Spring and web service background this is where I'd >>> normally wire in a domain repositories and services. This doesn't >>> seem to fit the model of having a new Resource Class per request. >>> Can someone explain the right mental model for this? >>> Thanks, >>> Ian. >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2008. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> Resteasy-developers mailing list >>> Res...@li... >>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers >> >> -- >> Bill Burke >> JBoss, a division of Red Hat >> http://bill.burkecentral.com > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |