Hi Valdis,

Soory for the confusion, but raw Regex are not allowed anymore in routed
URIs. This logic was refactored to conform to the new URI Template RFC (see
http://bitworking.org/projects/URI-Templates/). 

But there is an alternative way to achieve what you want, see the updated
tutorial:
http://www.restlet.org/tutorial#part11

        // Attach the Handlers to the Router
      router.attach("/users/{user}", account);
      router.attach("/users/{user}/orders", orders);
      router.attach("/users/{user}/orders/{order}", order);

By default, the variables will match URI segment characters, but you can
change that by specifying variable descriptors on the route's template.
Check the Route, Template and Variable classes.

Best regards,
Jerome  

> -----Message d'origine-----
> De : Valdis Rigdon [mailto:[EMAIL PROTECTED] 
> Envoyé : mercredi 10 janvier 2007 15:54
> À : [email protected]
> Objet : Router URI template (regex)
> 
> I've just started looking at the Restlets project, since RC1, and I 
> can't seem to get a simple example working.  It looks like it 
> was broken 
> in RC1 with changeset 1267 regarding quoting of regex characters in 
> Template.  I basically copy and pasted the 'trace' example from the 
> tutorial, but tried to attach a regex pattern for the URI so it would 
> match any character, but when hitting the URL, I'm getting back a 404.
> 
> I've traced it down to org.restlet.util.Template where 
> getRegexPattern() 
> is invoked.  It's quoting the "special" regex characters, but 
> that seems 
> to be building the wrong regex pattern, especially for character sets.
> 
> In short, I see examples that show you can attach a Restlet 
> to a Router 
> using "/[a-z]+", but that didn't work for RC1 or RC2.  Is that not 
> supposed to work now? Is there a different way to do this?

Reply via email to