Question: How can we obtain the @Path value for the proxied resource interface from a JAX-RS interceptor/filter?
Detail: When a HTTP request comes through a service using JAX-RS it is matched using an annotated Resource java interface
public interface UserClient
{
@GET
@Path("/user/{id}")
User getUser(@PathParam("id") UUID id);
}
Within JAX-RS is also a chain-of-responsibility pattern of intercepters and filters. Currently we use a filter (ClientRequestFilter) to record our network calls in our intra-service tracing platform.
We have the opportunity to give our traces a display name, and this is grouped/indexed by the tracing platform. I would like to use the rest endpoint as a name, however if using @Path variables this becomes part of the URI, and as such your IDs (in the above example) also get included, and as such instead of your tracing platform grouping calls together like /user/{userId} with a single name, you end up with many names /user/1, /user/2, /user/n.
Is there any part of the JAX-RS framework where you can intercept http calls and you have access to the Resource proxy interface you have matched for that http call? Or some other way to determine the pattern that a http call was matched to?