users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: HEADS-UP: Revise MBR selection mechanism?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Wed, 23 May 2012 18:04:52 +0200

On May 23, 2012, at 4:49 PM, Sergey Beryozkin wrote:

> On 23/05/12 15:37, Marek Potociar wrote:
>> Hello experts,
>>
>> please review the following issue
>> http://java.net/jira/browse/JAX_RS_SPEC-187 and provide your feedback.
>> Apparently this may be considered a BW-breaking change. If we make it,
>> the implementations may need to provide a BW compatibility switch if
>> necessary.
>
> I do not understand that issue at all. The resource method returns InputStream therefore the MBW supporting InputStream must win

Not necessarily - see the section of the spec referenced from the issue - 4.2.2, step 4.

The response media types takes precedence over the generic MBW type, so if the response is "application/json" InputStream and a custom Jackson JSON provider claims to support any java type (Object) for "application/json", it will win over the default InputStream provider that supports InputStream for any media type. That is however most likely not what the user wanted.

The issue suggests to reverse this ordering.

Also, the spec mandates that custom providers should always take precedence over the default ones, but the spec is not clear whether this should really be a primary or tertiary key. For MBW the issue suggests that the right thing would be to explicitly define it as a tertiary key.

Marek

>
> If Jackson says it can support all types, then it's chosen, otherwise not.
>
> I'd appreciate some more clarifications
>
> Cheers, Sergey
>
>>
>> Marek
>>
>>
>