users@jax-rs-spec.java.net

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

From: Bill Burke <bburke_at_redhat.com>
Date: Thu, 24 May 2012 12:16:06 -0400

On 5/24/12 11:14 AM, Sergey Beryozkin wrote:
>> @Consumes("application/json")
>> public class JsonReader implements MessageBodyReader<Object> {} //builtin
>>
>> @Consumes("*/*")
>> public class InputStreamReader implemetns MessageBodyReader<InputStream>
>> {} // builtin
>>
>>
>> @Consumes("application/json")
>> public class JsonInputStreamReader implements
>> MessageBodyReader<InputStream> {} // application provided provider
>>
>> Make more sense?
>>
> Yes it does. What exactly in the current algorithm prevents it is from
> happening now ? JsonInputStreamReader simply wins (InputStream is more
> specifc than Object)
>

Consider removing JsonInputStreamReader from the list of providers
above. In the old model the JsonReader would always match for:

Content-Type: application/json

@POST void post(InputStream);

JsonReader would also always match for String, byte[], Reader, etc...So,
you'd have to write and deploy an XXXInputStreamReader for each and
every provider like JSonReader (For us we have YAML too that fits the
same pattern).

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com