users@jersey.java.net

Re: [Jersey] JSONP

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Thu, 21 Jan 2010 15:11:34 +0100

On Thu, Jan 21, 2010 at 10:22:00AM +0000, Paul Sandoz wrote:
>
> On Jan 21, 2010, at 9:08 AM, Jakub Podlesak wrote:
> >Since the Jackson writer is enabled by the application via the META-
> >INF/services,
>
> Ah, i got it now. Yes, in the sample (or registered via Application/
> ResourceConfig) application registered providers will take precedence.
>
>
> >it is given higher priority then the JSONWithPaddingProvider, and
> >the delegation
> >never happens.
> >
>
> Possible solutions and work around(s):
>
> 1) introduce a priority ordering. This would be easy to with
> @Produces("application/json;qs=2, */*").
> or state that certain providers cannot be overridden.

That would be great, even if it still allows for more such providers
with the same quality parameter value.

>
> 2) re-register the JSONWithPaddingProvider ahead of the Jackson
> providers.

If you mean declaring that together with the Jackson provider
at the application META-INF/services, i have tested it and it did not work.
I think there is not guaranteed the providers order from the file would be kept
withing the runtime.

>
> 3) Jersey declares to Jackson an exclude list of classes or package.

That would mean changes in Jackson. Maybe we can just introduce
a proxy provider in a separate Jersey module to call the Jackson provider for everything
except the JSONWithPadding. That would also remove the necessity of
the special META-INF/services files to enable the Jackson JSON provider.

~Jakub

>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
http://blogs.sun.com/japod