users@jsr311.java.net

Re: Few question about custom regular expressions

From: Sergey Beryozkin <sergey.beryozkin_at_progress.com>
Date: Tue, 2 Dec 2008 17:48:17 -0000

> 1. Section 3.7.3/1 says "URI encode the template, ignoring URI template variable specifications"
>
> I don't quite understand it. For ex :
>
> @Path ("{bar:barfoo}")
>
> Which part of this value needs to be URI encoded and when failing to do so will produce unexpected results ?
> There could be requests with URL-encoded URIs but I'm not sure why say we can't do
>
> @Path ("{bar:bar%20foo}")
>
> if we were to handle URIs like /bar%20foo ?

Sorry, it's in the spec in section 3.4 I believe.
So @Path ("/bar foo/{bar:bar foo}")

is equivalent to

@Path ("/bar%20foo/{bar:bar%20foo}")

Correct ?

if yes then I'd still appreciate the answers to the other 3 questions

Thanks, Sergey

>
> 2. Section 3.7.3/2 says "Escape any regular expression characters in the URI template, again ignoring URI template variable
> specifications"
>
> Would it be possible to explain when it's needed ? I've implemented 3.7.3/3-3.7.3/5 bits and I'm not sure why I'd need to do the
> additional escaping - as a user would escape all the built-in regular expression characters anyway when specifying a Path's value
>
> 3. @Path JavaDocs allows for WSP (whitespace characters ?) before/after a template variable name and a custom regular expression.
> Something like this probably :
>
> @Path ("{ bar : barfoo }")
> I'm assuming that ' bar ' and ' barfoo ' obtained after handling this value will need to be String.trim()-ed, is it correct
>
> I've followed this thread :
> https://jsr311.dev.java.net/servlets/BrowseList?list=users&by=thread&from=1223717
>
> but obviously I'm still missing some details
>
> 4. Section 3.7.2.2.f says among other things :
>
> sort using the number of capturing groups as a secondary key (descending order)
> sort using the number of capturing groups with non-default regular expressions as the tertiary key (descending order)
>
> Question : 'the number of capturing groups' - is it the total one, including those with with non-default regular expressions ?
>
> Many thanks, Sergey
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>
>