users@jsr311.java.net

Re: Sub-Resource Locators

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 01 Aug 2008 13:04:04 +0200

Marc Hadley wrote:
>>> 1) returning a Class from the sub-locator;
>> This is Jersey-specific currently, right? Is it planned to include
>> this in the spec as well?
>>
> We haven't discussed that, I'm not opposed to it.
>

Me neither.


>> Alas, it doesn't help in my specific use case, because it's my own
>> application code calling the sub-resource locator (not the JAX-RS
>> runtime). I suppose that means I should really isolate my shared
>> application logic that's in the sub-resource class, but then I need to
>> be able to inject *that* into all the places it is needed.
>>
>> That sounds like the job for an IoC framework of some sort ... but I'd
>> rather not force a particular choice in (what amounts to) framework
>> level code.
>>
>>>
>>> 2) Injecting a ResourceContext that can be used to get an instance of a
>>> resource class from which it can be modified and then returned from
>>> the sub-locator; and
>>>
>> That would work for me if it was portable across JAX-RS
>> implementations (i.e. part of the spec).
>
> Injection of instances returned from a locator is problematic because
> the runtime doesn't know or control the lifecycle of the instance. Its a
> tough problem to crack without a unified IoC framework to handle
> creation and injection but we don't want to tackle that in this JSR,
> that's a job for WebBeans.
>

Agreed. Although the ResourceContext iface is rather simple i do not
know to what extent things will change as we look more closely at
WebBeans. So i would be reluctant to specify anything like this right now.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109