Hi all,
Maybe there is a way. You could make the "/file/{item}.{ext}" template work
by customizing the type of variable. By default it is Variable#TYPE_ALL.
In your case you should try something like:
myTemplate.getVariables().put("item", new Variable(TYPE_WORD));
myTemplate.getVariables().put("ext", new Variable(TYPE_WORD));
Let me know if it still doesn't work.
Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
-----Message d'origine-----
De : Thierry Boileau [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 11 septembre 2008 11:55
À : [email protected]
Objet : Re: URI templates and URI pattern matching in restlet
Mail sent on the 08/22 and apparently lost.
---
Hello,
I'm afraid the Template class does not allow you to set the variables as
you need.
I think it is simpler to define yor own templae class based on a reg exp
anduse it when you define the routes:
router.getRoutes().add(
new Route(router,
new MyTemplate(regexp),
restlet));
I send you a sample template class based on regexp pattern and a
server/client test code.
>> Hi Prashant,
>>
>> Just have a look at the Javadocs, there is a "match(String)" method that
you
>> can use. You might need to adjust the matching mode and the default
variable
>> to fit your matching needs.
>>
>> Best regards,
>> Jerome Louvel
>> --
>> Restlet ~ Founder and Lead developer ~ http://www.restlet.org
>> Noelios Technologies ~ Co-founder ~ http://www.noelios.com
>>
>>
>
>
> I'm looking for a way to match a URI in the form of
> /file/[a-z]{3}-[0-9]{5}.[a-z]+ i would want to put the first part (before
the
> dot) in one variable and the second part (after the dot) in another. Can
> somebody point me to an example or tutorial or something to do just that
if its
> possible to do it? I tried the form: /file/{item}.{ext} but this doesn't
work it
> looks like the dot is not used that way in the URI template schema. Also
the
> javadocs doesnt explain how to use the Template match function or what do
> adjust. Thanks.
>
>
>
--
Best regards,
Thierry Boileau
--
Restlet ~ Core developer ~ http://www.restlet.org <http://www.restlet.org/>
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
<http://www.noelios.com/>