users@jersey.java.net

Changes to path matching

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 23 Jul 2008 15:57:47 +0200

Hi,

The specification has undergone two changes (and will undergo a third,
see later) and i have implemented those two changes in the trunk:

1) Path parameters match 1 or more characters that are not '/'
    (previously it was zero or more of any character), unless the final
    parameter is unlimited, in which case it is the same as before.

2) Path parameter names are matching with the following regex:

     "\{([\w[-\w\.]*)\}"

    i.e. the name must begin with a word character then zero or more
    word characters, '-' or '.'.

I suspect and hope that such changes will not have much effect on
existing implements, although this is anecdotal based on how much i had
to change the existing unit tests.

The third change that will occur will be to support general regular
expressions. As part of this we will be removing the 'limited' parameter
as of the @Path annotation, so instead of this:

   @Path(value="contents/{path}", limited=false)

one would do this:

   @Path(value="contents/{path: .*}")

It opens up a very powerful way to match e.g.,

   @Path(value="contents/{number: \d+}")

but guns, hair triggers and feet come to mind, so it is very much user
be aware.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109