users@jersey.java.net

Re: [Jersey] Access to a classes _at_Path

From: Moises Lejter <moilejter_at_gmail.com>
Date: Fri, 5 Mar 2010 14:12:57 -0600

Hmm - I thought that

> URI personResource = uriInfo.getBaseUriBuilder()
> .path(PersonEndpoint.class, "retrieve")

would end put building the combined path from PersonEndpoint
and the retrieve method within it... Are they separate (and your
example the right way to go) because PersonEndpoint could be
a (non-root) subresource?

Thanks!

Moises

On Mar 5, 2010, at 2:05 PM, Marc Hadley wrote:

> If you want to build an absolute URI the best way is to start from UriInfo like this:
>
> @Context UriInfo uriInfo;
>
> URI personResource = uriInfo.getBaseUriBuilder()
> .path(PersonEndpoint.class)
> .path(PersonEndpoint.class, "retrieve")
> .build(personAddressMapping.getPersonId());