jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: First steps

From: Adam Bien <abien_at_adam-bien.com>
Date: Thu, 10 Mar 2011 20:29:43 +0100

On 10.03.2011, at 20:03, Markus KARG wrote:

>>>>> The problem is that he wants to inject information about the sub
>>>> resource into the creation of the EJB.
>>>> And this is a huge problem. It happens in every non-trivial
>>>> application.
>>> Well, our application is far from being trivial but the problem does
>> not
>>> happen in ours. We just use a JAX-RS front door internally calling
>> into EJB
>>> 3 SLSBs which works pretty well and is rather simple to do. So "all"
>> should
>>> be replaced by "many". ;-)
>> O.k. then you will have to lookup the EJBs in a POJO. It works already
>> - you are right.
>
> Yes we're using dynamic lookup in the JAX-RS resource.

As I wrote - all non-trivial applications are affected :-)
>
> But maybe your idea makes things just even better, so we should add it to
> Robert's list. I just was curious to understand it's inner sense, but we can
> discuss that later. Possibly I just don't see the big trick with it.
>
>>>> The simplest possible solution would be something like:
>>>> @Stateless
>>>> public SubResource{
>>>> @PathParam
>>>> long id;
>>>> }
>>>> or the injection of a more generic "JAX-RS" context into EJB / CDI
>>>> bean.
>>>
>>> So to sum up, what you're actually like to have is using a JAX-RS
>> resource
>>> as a SLSB, so whenever a JAX-RS method is invoked, it should be
>> treated just
>>> as if it would be an remote invocation of the SLSB, right?
>> Or a local invocation of the EJB. Whether it is an EJB or CDI managed
>> bean, it doesn't matter. A managed object needs to get a reference to
>> the current JAX-RS context (PathParam). Otherwise you will have to
>> instantiate the object by yourself. Then it won't be managed and DI
>> will not work...
>
> Ok, understood. Sounds like the same thing that is getting discussed
> currently on Jersey's user list (don't know if you followed it). As our
> architecture currently is split into a JAX-RS facade and EJB SLSB backend
> (and since we had no trouble with that) I just wasn't so deeply into the
> ideo of consolidating both. But I understand that this could be beneficial
> in some scenarios.
>
> The question is how this could be made possible. Maybe you already have a
> discussion paper in your desk to add to Roberto's tracker item?
>
> Regards
> Markus
>
>