Paul Sandoz wrote:
> Sergey Beryozkin wrote:
>> Hi
>>
>> My understanding is that you can get @Context values injected as
>> method parameters
>> of subresource locator resource methods
>>
>
> Correct. Although a disadvantage is that the UriInfo parameter may get
> "sprinkled" over many methods,
>
> I have been experimenting with three implementation specific things in
> this respect.
>
> 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?
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).
> 3) See a discussion in the comments on a blog entry i wrote [1].
>
> Paul.
>
Craig
> [1]
> http://blogs.sun.com/sandoz/entry/ejb_injection#comment-1217426760000
> http://blogs.sun.com/sandoz/entry/ejb_injection#comments
>