Hi Roman,

I've entered an issue report to keep track of this:

"Problem with UriInfo.getPath()"
http://restlet.tigris.org/issues/show_bug.cgi?id=593

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 : Roman Geus [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 21 août 2008 16:32
À : [email protected]
Objet : Problem with UriInfo.getPath()

Hello all

Calling the code

> @Path("test")
> public class UriInfoResource {
>     
>     @GET
>     @Path("example")
>     @Produces("text/plain")
>     public String getPlain(@Context UriInfo uriInfo) {
>         StringBuilder sb = new StringBuilder();
>         sb.append("UriInfo data:\n");
>
>         List<PathSegment> segments = uriInfo.getPathSegments();
>         for (PathSegment s : segments) {
>             sb.append("    path segment " + s.toString() + "\n");
>         }
>         sb.append("uriInfo.getBaseUri():" + uriInfo.getBaseUri() + "\n");
>         sb.append("uriInfo.getPath():" + uriInfo.getPath() + "\n");
>         sb.append("uriInfo.getAbsolutePath():" + 
> uriInfo.getAbsolutePath() + "\n");      
>         return sb.toString();
>     }    
>
> }
using the URL

> http://localhost:8182/test/example
produces the output
> UriInfo data:
>     path segment test
>     path segment example
> uriInfo.getBaseUri():http://localhost:8182
> uriInfo.getPath():http://localhost:8182/test/example
> uriInfo.getAbsolutePath():http://localhost:8182/test/example
According to the docs UriInfo.getPath() should return a relative path.

Cheers,
Roman

--
Roman Geus
Paul Scherrer Institut
AIT
Scientific Computing
5232 Villigen PSI
Switzerland

Tel: +41 56 310 54 85
Fax: +41 56 310 36 49

e-Mail: [EMAIL PROTECTED]

Reply via email to