users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: best match for wildcard?

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 22 May 2013 11:08:38 +0100

On 21/05/13 12:32, Bill Burke wrote:
> Doesn't actually help that much for the TCK test. As you said before,
> the default Content-Type is application/octet. Seems like I found
> another bug.
Sure, I was just in the middle of becoming confused with */*.

As far as your example goes, if we do have */*, then actually, it has to
be a method accepting application/xml. It loses on a distance factor to
the method with */* but wins because S(*/*,application/xml) is
application/xml;d=2 and hence it is better than */*;d=0

Sergey

>
> On 5/21/2013 4:59 AM, Sergey Beryozkin wrote:
>> Hi Bill
>>
>> I start 'suspecting' that when we have */* then start() would be the
>> match. This assumes a distance between */* & */* is actually 0, while a
>> distance between */* and application/xml is 2, the latter loses.
>>
>> But if you think about it, it probably does not make sense that a "*/*"
>> payload is routed to start(Action) expecting XML as "*/*" can represent
>> plain text, etc
>>
>> Sergey
>>
>> On 20/05/13 14:26, Bill Burke wrote:
>>>
>>>
>>> On 5/20/2013 5:01 AM, Sergey Beryozkin wrote:
>>>> On 20/05/13 09:55, Sergey Beryozkin wrote:
>>>>> On 19/05/13 23:36, Bill Burke wrote:
>>>>>> If the Content-Type header is null, then the implicit media type of
>>>>>> the
>>>>>> request is "*/*", correct? Given that, which method would match?
>>>>>>
>>>>>> @POST
>>>>>> @Path("start")
>>>>>> public Response start();
>>>>>>
>>>>>> @POST
>>>>>> @Consumes(MediaType.APPLICATION_XML)
>>>>>> @Path("start")
>>>>>> public Response start(Action action);
>>>>>>
>>>>>>
>>>>>> What is the "best match" for a Content-Type of "*/*"? Another "*/*"
>>>>>> takes precedence in this case because it is an exact match?
>>>>> start(Action action)
>>>>
>>>> Actually, in this case, it has to be start() - application/octet-stream
>>>> is a default value when CT is null
>>>>
>>>
>>> Ah, thanks. That actually helps a lot.
>>>
>>
>>
>