In our Jersey application we like to present/restrict different parts of our API based on roles. To be specific we would like to only offer links to resources which the role can visit - i.e. already when preparing response A we would not even offer a link to a resource X if the user would not be allowed to use X anyway.
To be able to distinguish those links we would like to be able to ask Jersey how it would resolve a certain URI - i.e. to what resource and to what method on that resource. If we could do that we would also be able to detect whether it is annotated in a way (@RolesAllowed) that would not permit access ... and hence we would be able to skip adding the link to the response in the making. Obviously Jersey has this knowledge/capabilities since it can resolve incoming requests.
The question is: Is there a way to ask Jersey what a URI would resolve to in terms of both class and method?
Edit: Yes ... we noticed there is a ResourceContext (which can be injected) which can provide us with the matching resource class ... but we still cannot find what method a URI would resolve to.