users@jsr311.java.net

Re: Converting URI templates to regular expressions in 0.9

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 09 Jul 2008 09:26:44 +0200

On Jul 8, 2008, at 7:37 PM, Sergey Beryozkin wrote:
>
> I'd just like to clarify one thing. After converting URI templates
> to regular expressions as per the 0.9 spec, I can see that, for ex,
> with the following two classes
>
> @Path("{foo}")
> class ResourceClassA {
> }
>
> @Path("{foo}/{bar}")
> class ResourceClassB {
> }
>
> a /foo/ request
>
> (note the trailing '/')
>
> matches ResourceClassA as opposed to ResourceClassB.
> I think it makes total sense - but I know that up to 0.9 this
> request matches ResourceClassB, due to (.*?) used to substitute
> template variables...
>
> Can someone confirm please that what I observe is indeed expected...
>
Yes, that is correct. In 0.9 we changed the regex such that template
parameters match one or more characters rather than 0 or more. This
gives less surprising results in a variety of situations which we
explored prior to the change.

Marc.

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