Hello Hirk and Stefan,
the score of the first route is computed without taking into account the
query: from this point of view "/customer?blahblah" is just equal to
"/customers" and the score is 1.0.
as a workaround, you can set the matching query parameter on both routes
to true, or declare the route with query before the other one.
Best regards,
Thierry Boileau
> Hi,
>
> I think the query (after the "?") will not be respected, so the first
> query matches "/customer" and "/customer?surname={bla}", and the second
> one will matching nothing. Maybe I'm wrong, but I think so.
>
> @Jerome, Thierry: Perhaps it is useful to throw an
> IllegalArgumentException, if a questionmark is included in the route
> while adding?
>
> best regards
> Stephan
>
> Kirk Daries schrieb:
>
>> Hi Guys,
>>
>> I seems to have a route scoring problem.
>>
>> Here are the two routes:
>>
>> /customers --> resourceA
>>
>> /customers?surname={bla} --> resourceB
>>
>>
>> My router currently has the following properties set:
>>
>>
>> router.setDefaultMatchingMode(Template.MODE_EQUALS);
>> router.setRoutingMode(Router.MODE_BEST_MATCH);
>> router.setDefaultMatchingQuery(false);
>>
>>
>> Now the 2nd route that specifies the query parameters, i specifically enable
>> the searching on the query portion.
>>
>> i.e.
>> route.setMatchingQuery(true);
>>
>> The test uri i'm testing with is:
>> /customers?surname=adams
>>
>> The problem is that currently, both routes are scoring 1.
>>
>> Is there any other hint i can give restlet that the 2nd route should score
>> greater than the first route?
>>
>> How have have you handled similar problems?
>>
>> --KD
>>
>>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2455153
>
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2455309