Jersey: How to get the URI of a resource?
-
15-06-2021 - |
문제
ResourceContext.matchResource(URI) allows me to convert a URI to a Resource, but how do I go from a Resource to its URI?
해결책
Answering my own question:
@Context UriInfo uriInfo;
public URI getUri()
{
return uriInfo.getBaseUriBuilder().path(MyResource.class).build();
}
제휴하지 않습니다 StackOverflow