users@jsr311.java.net

Few question about custom regular expressions

From: Sergey Beryozkin <sergey.beryozkin_at_progress.com>
Date: Tue, 2 Dec 2008 16:47:11 -0000

Hi,

I have some questions about section 3.7.3 of the specifications and the JavaDocs of the @Path annotation. I'm sorry if these
questions are offtopic really...

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 ?

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