Hi John,

We have an RFE to improve our support for URI Template. I've added a comment
in it to attempt to cover your use case better:

"Update the URI template support"
http://restlet.tigris.org/issues/show_bug.cgi?id=476

This would result in this pattern: 
"/foos/{foo}/bar{-prefix|.|ext}"

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com

-----Message d'origine-----
De : John D. Mitchell [mailto:[EMAIL PROTECTED] 
Envoye : vendredi 17 octobre 2008 16:54
A : [email protected]
Objet : Re: uriPattern exactness

On Friday 2008.10.17, at 04:01 , Jerome Louvel wrote:
[...]
> In combination with MODE_EQUALS, you could also add a variable for  
> your
> extensions like: "/foos/{foo}/bar.{ext}". That could reduce the  
> number of
> alternative routes you would have to attach.

Yes and no.  I use that trick but I still have to also have e.g.:
/foos/{foo}/bar
as well since the dot shouldn't be there if there's no extension. When  
I last looked, I couldn't find any way to make things optional (so if  
it's still not possible to do that in the latest versions, I'd suggest  
looking into it -- something like /bar(.{ext})? so that it hangs  
together properly).

FWIW, I do send both to the same resource and just have the resource  
look for the optional parts. e.g.:
         ext = (String) request.getAttributes().get("ext");
         if (null == ext)
             ext = "";

I've also used a combination of EQUALS and the default STARTS_WITH to  
keep the numbers of routes a bit more manageable.

Take care,
John

Reply via email to