users@jersey.java.net

Re: [Jersey] _at_Produces on ContextResolver impls <was> Re: [Jersey] Re: Adding @Provider via META-INF/services, injecting @Context Providers?

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Mon, 4 May 2009 09:39:19 -0700

On Mon, May 4, 2009 at 2:45 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>
> On Apr 29, 2009, at 7:45 PM, Tatu Saloranta wrote:
...
>> So, if I am correct, I should declare that my ObjectMapper context
>> provider produces "application/json",
>
> Yes.
>
>> but make MessageBodyWriter provider access it using just null?
>
> No, if things were working described in the previous email you should just
> do this:
>
> ContextResolver<ObjectMaper> r =
> _providers.getContextResolver(ObjectMapper.class, mediaType);
>
> but i implemented things incorrectly.
>
> Perhaps the best recommendation is for developers to implement a
> ContextResolver<ObjectMapper> with no @Produces until i fix things. I have

Ok, thanks. I will add comments around code to clarify this.
Thanks!

> logged an issue:
>
> https://jersey.dev.java.net/issues/show_bug.cgi?id=288

Ok good.

>> But ideally I want to use sensible values, if for nothing else just as
>> documentation.
>
> Yes. Thanks for your persistence here, you have found a number of issues i
> need to fix!

Thank you for addressing issues very quickly!

It takes a while to understand dependency injection used, but it
allows for flexible and powerful configuration of wide variety of
loosely connected components, which is great. And absolutely necessary
too, given very generic applicability of JAX-RS: like James suggested
it could (should?) become THE web service framework on Java land.

-+ Tatu +-