users@jersey.java.net

UriBuilder

From: Richard Wallace <rwallace_at_thewallacepack.net>
Date: Fri, 07 Dec 2007 11:12:49 -0800

Hello again,

I'm trying to use the UriBuilder.fromResource(MyResource.class) to
easily build links to other resources. To my surprise, doing something
like the following:

UriBuilder.fromResource(MyResource.class).build("resourcename");

where MyResource has the @Path("/myresources/{name}") results in the URI
"http://:-1/myresources/resourcename" to being constructed. I was a bit
surprised by this, but being that the fromResource() and other
UriBuilder methods that return a builder instance are static, they would
have difficulty getting access to the ServletContext and ResourceConfig
to be able to properly build the full uris.

Is there another utility method I should be using to do this or am I
going to have to come up with some other solution?

Thanks,
Rich