jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Section 3.7.2: is distance calculation correct for wildcards ?

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Mon, 15 Apr 2013 22:26:36 +0100

On 15/04/13 17:08, Santiago Pericas-Geertsen wrote:
>
> On Apr 15, 2013, at 6:09 AM, Sergey Beryozkin<sberyozkin_at_talend.com> wrote:
>
>> Hi Santiago, all
>>
>> I'm not sure if it is a problem or not, I was not able to come up with the the case confirming it might be, but I'm typing it here in case someone can spot something,
>>
>> Basically, if we have 'text/xml vs text/*', then the distance is 1, and if we have 'text/* vs text/*' then the distance is 0 (as per the spec example, S(*/*;q=0.2, text/*;qs=0.9) = text/*;q=0.2;qs=0.9;d=1,
>> ).
>>
>> As I said I was not able to come up with the example where it would make any unexpected difference, IMHO 'text/* vs text/*' should produce a distance 1, but if no one can see any issues with the distance 0 in this case then it works for me too :-)
>
> I don't see an issue. Wildcard comparison is for Accept and @Produces. Conceptually, identical types (even wildcard ones) should result in a distance of 0.
>

In 'text/xml vs text/*', we have a specific type on the output,
text/xml;d=1. The fact that 'text/* vs text/*' -> text/*;d=0 does not
seem right to me, the only reason it does not win is due to a specific
text/xml winning over text/*, hence it works after all...

FYI, I did not spot originally that text/* vs text/* would lead to
text/*;d=0. At the moment, in CXF it is text/*;d=1 - and it does not
make a difference, the fact that it is d=1.

Thanks, Sergey

> -- Santiago
>