Thanks. Using Variable.TYPE_URI_ALL works. Though it would be nice to have
something like Variable.TYPE_URI_ALL_WITHOUT_QUERY or something like that since
{id} now includes the query string. That's not an issue in my case, though, so
it works well enough.
Cheers,
Michael
-----Original Message-----
From: Jerome Louvel [mailto:[EMAIL PROTECTED]
Sent: 05 February 2008 08:25
To: [email protected]
Subject: RE: template question
Hi all,
Michael, if you don't want to introduce redundancy in your URI templates, you
can also use a hierarchy of routers, or maybe use String constants to compose
the URI templates.
Concerning your {id} variable, it is possible to make it match any URI
character.
Template template = router.attach("/{foo}/{bar}/{baz}/{id}",
myCustomFinder).getTemplate();
template.getVariables().put("id", new Variable(Variable.TYPE_URI_ALL));
Best regards,
Jerome
> -----Message d'origine-----
> De : Rhett Sutphin [mailto:[EMAIL PROTECTED]
> Envoyé : lundi 4 février 2008 20:17
> À : [email protected]
> Objet : Re: template question
>
> Hi,
>
> On Feb 4, 2008, at 12:21 PM, Stephan Koops wrote:
> > Hello Michael,
> >> and most importantly:
> >>
> >> /a/b/c/1/x/y/z resulting in foo=a,bar=b,baz=c,id=1/x/y/z
> >>
> > I've had the problem with "1/x/y/z" in the JAX-RS
> extension. Take a
> > look to the constructor in projekt org.restlet.ext.jaxrs
> (see trunk
> > in repository), class org.restlet.ext.jaxrs.impl.PathRegExp. It's
> > some weeks ago, that I impemented it, so I can't tell every detail
> > by head. But feel free to ask.
>
> By my reading, this sort of expansion violates the URI Template
> specification draft (
> http://bitworking.org/projects/URI-Templates/draft-gregorio-ur
itemplate-02.txt
> ). See section 3.1:
>
> The value of every non-list variable, and the individual values in
> list variables, must come from ( unreserved / pct-encoded ).
>
> "Unreserved" here is defined by RFC 3986, section 2.3:
>
> unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
>
> It seems like it might be possible to get a result like "id=1/x/y/z"
> using the listjoin template operator, but I don't know if restlet
> supports that.
>
> Rhett
CONFIDENTIALITY NOTICE
This e-mail (and any attached files) is confidential and protected by
copyright (and other intellectual property rights). If you are not the
intended recipient please e-mail the sender and then delete the email and
any attached files immediately. Any further use or dissemination is
prohibited.
While MTV Networks Europe has taken steps to ensure that this email and
any attachments are virus free, it is your responsibility to ensure that
this message and any attachments are virus free and do not affect your
systems / data.
Communicating by email is not 100% secure and carries risks such as delay,
data corruption, non-delivery, wrongful interception and unauthorised
amendment. If you communicate with us by e-mail, you acknowledge and
assume these risks, and you agree to take appropriate measures to minimise
these risks when e-mailing us.
MTV Networks International, MTV Networks UK & Ireland, Greenhouse,
Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions
International and Comedy Central are all trading names of MTV Networks
Europe. MTV Networks Europe is a partnership between MTV Networks Europe
Inc. and Viacom Networks Europe Inc. Address for service in Great Britain
is UK House, 180 Oxford Street, London W1D 1DS, UK.