users@jersey.java.net

Re: [Jersey] Access to a classes _at_Path

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

I think you want to use a UriBuilder.
The example I have looks like this:

private String buildRef(Airport a, UriBuilder ub) {
  URI result = ub.path(AirportRM.class,"getByCode").build(a.getCode());
  return result.toString();
}

where "AirportRM" is a resource class, and "getByCode" is one of the
methods in it. The URI will be built based on the URI template
detemined by the @Path annotations for AirportRM and its method
getByCode(), with the param expected replaced by the parameter to
build().

Moises