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