Is there a way to obtain the java.lang.reflect.Method
of the method (which is annotated with @Path
) which will be called for a given HttpServletRequest
?
Here is my use case : I'm in a Java EE Filter
and want to know if the method which will be invoked later is annotated with another specific annotations.
(I'm using RESTEasy 3.0.7)
It's easy if you can use a ContainerRequestFilter instead of a normal Servlet Filter.
@Provider
public class SomeFilter implements ContainerRequestFilter {
@Context
private ResourceInfo resourceInfo;
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
Method method = resourceInfo.getResourceMethod();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With