Jersey method to be called

I am trying to implement a ContainerRequestFilter that will check whether the method to be called will be annotated with @Authorize, and if so, a method will be called that will check if the user is allowed to return not Authorized and continue the request based on the return value.

Now I'm wondering if there is an easy way to get information about which method will be called if I continue the request?

+4
source share
1 answer

Check out the RolesAllowedResourceFilterFactory that comes with the T-shirt to see how this should work. factory implements ResourceFilterFactory , and its only implementation method:

  List<ResourceFilter> create(AbstractMethod am); 

In this way, you can get the method that you accessed. You can pass the abstract method to your filter or create the correct filter in advance.

+1
source

Source: https://habr.com/ru/post/1436143/


All Articles