users@jsr311.java.net

Re: JAX-RS: _at_Path regex syntax

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 31 Jul 2008 17:09:54 -0400

On Jul 31, 2008, at 11:01 AM, Marc Hadley wrote:

> On Jul 28, 2008, at 11:27 AM, Paul Sandoz wrote:
>>
>> The intention was to support your first preference in that "regex"
>> must have matching open and close braces.
>>
> Right. Since unescaped '{' and '}' and not valid in URI paths then I
> don't see that disallowing their unmatched use in the regex will
> cause any problems.
>
That should read "Since unescaped '{' and '}' are not valid in URI
paths..."

>>> Allowing spaces and tabs (WSP) in a placeholder seems a bit
>>> unnecessary. I guess it doesn’t do much harm, though I wouldn’t be
>>> surprised if some code used the regex “\s*” or String.trim() to
>>> implement *WSP, which is not quite correct.
>>
>> Good point.
>>
> I think I'm missing something. Why would use of String.trim() cause
> a problem ? Any literal WSP character in regex would have to be in
> encoded form otherwise it wouldn't match the corresponding encoded
> char in the URI...
>
> Marc.
>
>>
>> Manger, James H wrote:
>>> The @Path#value javadoc <https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/Path.html#value()
>>> > is missing the ABNF for “regex”. It only includes:
>>> param = "{" *WSP name *WSP [ ":" *WSP regex *WSP ] "}"
>>> name = (ALPHA / DIGIT / "_")*(ALPHA / DIGIT / "." / "_" / "-" ) ;
>>> \w[\w\.-]*
>>> My 1^st preference is:
>>> regex = *( nonbrace / "{" *nonbrace "}" )
>>> nonbrace = any char other than "{" and "}"
>>> It allows a regex like “\d{1,10}” (matching between 1 and 10
>>> digits).
>>> Only a deliberately diabolical regex won’t be accepted (eg “[^}]*”).
>>> I suspect Marc might prefer my 2^nd preference:
>>> regex = *nonbrace
>>> nonbrace = any char other than "}"
>>> This is a little simpler.
>>> It disallows a regex like “\d{1,10}”, though it could be rewritten
>>> as “\d\d?\d?\d?\d?\d?\d?\d?\d?\d?”.
>>> [Earlier discussion on this issue: from https://jsr311.dev.java.net/servlets/ReadMsg?list=users&msgNo=538
>>> <https://jsr311.dev.java.net/servlets/ReadMsg?
>>> list=users&msgNo=538>]
>>> Allowing spaces and tabs (WSP) in a placeholder seems a bit
>>> unnecessary. I guess it doesn’t do much harm, though I wouldn’t be
>>> surprised if some code used the regex “\s*” or String.trim() to
>>> implement *WSP, which is not quite correct.
>>> James Manger
>>> P.S. RFC 2234 “ABNF” has been replaced by RFC 5234 “ABNF”.
>>
>> --
>> | ? + ? = To question
>> ----------------\
>> Paul Sandoz
>> x38109
>> +33-4-76188109
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
>> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>>
>
> ---
> 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
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.