users@jersey.java.net

Re: [Jersey] Re: Adding _at_Provider via META-INF/services, injecting @Context Providers?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 27 Apr 2009 13:12:46 +0200

On Apr 25, 2009, at 1:45 AM, Tatu Saloranta wrote:

> On Fri, Apr 24, 2009 at 4:03 PM, Tatu Saloranta
> <tsaloranta_at_gmail.com> wrote:
>> Quick question: I am adding MessageBodyReader and -Writer providers
>> using META-INF/services instructions.
>> That works well, gets plugged in and all. So far so good.
>>
>> But now I am trying to get Providers injected, so that I can look up
>> piece of configuration provider needs (with defaulting for cases
>> where
>> no one explicitly gives it).
>> I was thinking that:
>>
>> @Context
>> protected Providers _providers;
>>
>> with Provider would be found & injected, but it looks as if it
>> wasn't.
>
> Correction: this part actually works, and Providers gets injected.
>
> My problem seems to be the next step; ensuring that my
> ContextProvider<T> matches with call. Looks like MediaType doesn't
> match by default for some reason (if I pass type I get in).
>

Can you show me the implementation code?

Paul.