Hi Ralf,
Stephan's idea is probably the best for now as the slashes will be encoded
and ignore by the parsing done in getSegments().
In the future, we want to add automatic encoding and decoding to the
Template class so this would be fully transparent as you expected. Just
marking a variable as TYPE_URI_PATH should be enough for the Template class
to know that the {servier_url} value needs to be encoded or decoded.
We have a related RFE already:
"Generation of URIs from URI templates and encoding"
http://restlet.tigris.org/issues/show_bug.cgi?id=506
Best regards,
Jerome
-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 30 mai 2008 12:43
À : [email protected]
Objet : Re: resourceRef.getSegments()
Hi Ralf,
you could url encode the service url.
best regards
Stephan
Ralf Bommersbach schrieb:
> Hi there.
> Suppose I have an URL that itself has an URL embedded, like
> .../service/{service_url}/resource1/resource2/.../...
>
> If I call request.getResourceRef.getSegments(), I get a list of all
> the Segments of the URL, BUT because the method only looks for slashes
> it also tokenizes the pieces of the embedded url. What if I want the
> embedded URL as ONE Segment. Is there a built-in way in Restlet to do
> this? (hint: I have already declared the template param service_url as
> Variable.TYPE_URI_PATH.
>
> Best regards
> Ralf