users@jsr311.java.net

Re: Few question about custom regular expressions

From: Sergey Beryozkin <sergey.beryozkin_at_progress.com>
Date: Wed, 3 Dec 2008 15:43:57 -0000

>
>>>> @Path("a.b")
>>
>>> I need to have this test passing now :
>>>
>>> URITemplate uriTemplate = new URITemplate("/books/a.b");
>>> assertTrue(uriTemplate.match("/books/a.b"));
>>> assertFail(uriTemplate.match("/books/abc"));
>>
>> so I did this test and it works without me modifying any code, the resulting regular expression is
>>
>> "/books/a.b(/.*)?"
>>
>> This expression requires that only "a.b" is accepted.
>>
>> So, sorry I'm feeling silly, I'm still in the dark as to why I need to escape '.' in the above Path's value if the goal is to
>> ensure that only a literal '.' is allowed between 'a' and 'b'.
>>
> Try assertFail(uriTemplate.match("/books/acb"));
>
> That should fail but will not if you don't escape the '.' in the regex.
>
> /books/abc will fail anyway because of the final 'c' which doesn't match the final 'b' in the template.

I'm sorry yet again and thanks for spending the time and finding the typos in my code - this time it was definitely a not
JAXRS-specific question.
I have a failing test now - super.
I do need to spend more time reflecting on what I'm about to send rather than clicking Send immediately - I'll keep trying :-)

Cheers, Sergey

>
> Marc.
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>
>