I´m using JAX-RS Request filter where my endpoint annotation @Country contains some information of the country that my filter need to do some stuff.
@GET
@Path("/country")
@Country("ESP")
public Future<String> countryResource(Future<String> future) throws Exception {
So now my filter is invoked since this method contains the same filter
@Priority(3)
@Primary
@Provider
@Country
class CountryFilter extends ContainerRequestFilter {
override def filter(context: ContainerRequestContext): Unit = {
//Here I need to get the "ESP" from the endpoint annotation
}
}
I'm not an expert of JAX-RS
but I doubt is possible to know what information of the annotation of my endpoint has, but since the filter only is invoked in case a method add the annotation as well, I was just wondering if there was any magic here.
For now I was just using reflexion
to look for all methods annotated as @Country
and whose @Path
it would be the same as the context.getUtiInfo
of the ContainerRequestContext
.
Is this the best and most efficient way to do it?.
Regards.