Proposal for regexs in path template vars

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 22 Jul 2008 16:42:58 -0400

After some experimentation I've convinced myself that allowing
developers to specify regexs for their template parameters is
workable. Here's what I propose we do:

(a) Allow the developer to specify the content of the capturing group
for a template parameter. E.g. {foo: .+} would result in a capturing
group (.+) in the regex generated for the template. Whitespace around
the parameter name and regex will be stripped.
(b) If no regex is specified you get ([^/]+).
(c) Implementations will not be required to encode literals in the
regex (regardles of whether @Path.encode==true), developers have to do
that themselves.
(d) Remove the property since developers can use a regex
to adjust the bounds of a capturing group.
(e) The regex will be ignored by UriBuilder (no validation).
(f) For the purposes of the matching algorithm, the regex resulting
from a template will always have (/.*)? appended to the end (see
existing 3.7.3 step 6).

I attach some examples as a HTML table.


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