Pregunta

ResourceContext.matchResource(URI) allows me to convert a URI to a Resource, but how do I go from a Resource to its URI?

¿Fue útil?

Solución

Answering my own question:

@Context UriInfo uriInfo;

public URI getUri()
{
  return uriInfo.getBaseUriBuilder().path(MyResource.class).build();
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top