regexps in uri patterns

2007-01-19 Thread Vincent
Hi,

It used to be possible to do:
  router.attach("/foo/[0-9]*", ...);
>From the examples, it seems  that the new way is:
  router.attach("/foo/{id}", ...);

It makes for a cleaner and more self-documented code, but I wonder
if we're not losing some flexibility. For instance  I could need to
bind a resource to /foo/[0-9]*, and a different one to 
/foo/[a-z]*. This is no longer possible.


-Vincent.




RE: regexps in uri patterns

2007-01-19 Thread Jerome Louvel

Hi,

Indeed, we are now only relying on URI Templates [1]. But it is possible to
specify/change the type of a template variable.

Route route = router.attach("/foo/{id}", FooResource.class);
route.getTemplate().getVariables().put("id", new
Variable(Variable.TYPE_DIGIT));

Best regards,
Jerome

[1] http://bitworking.org/projects/URI-Templates/  

> -Message d'origine-
> De : news [mailto:[EMAIL PROTECTED] De la part de Vincent
> Envoyé : vendredi 19 janvier 2007 09:07
> À : discuss@restlet.tigris.org
> Objet : regexps in uri patterns
> 
> Hi,
> 
> It used to be possible to do:
>   router.attach("/foo/[0-9]*", ...);
> From the examples, it seems  that the new way is:
>   router.attach("/foo/{id}", ...);
> 
> It makes for a cleaner and more self-documented code, but I wonder
> if we're not losing some flexibility. For instance  I could need to
> bind a resource to /foo/[0-9]*, and a different one to 
> /foo/[a-z]*. This is no longer possible.
> 
> 
> -Vincent.
> 
>