users@jax-rs-spec.java.net

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

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Thu, 24 May 2012 18:26:35 +0200

On May 24, 2012, at 6:16 PM, Bill Burke wrote:

>
>
> 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).

Wow, looks like we produced almost the same response independently :)

Marek

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