I was wondering if it is possible to do the following trick with jersey restful resources:
I have an example jersey resource:
@Path("/example")
public class ExampleRessource {
@GET
@Path("/test")
@CustomPermissions({"foo","bar"})
public Response doStuff() {
//implicit call to checkPermissions(new String[] {"foo","bar"})
}
private void checkPermissions(String[] permissions) {
//stuff happens here
}
}
What I want to achieve is: before executing each resource's method to implicitly check the rights from the annotation by calling the checkPermissions method without actually writing the call inside the method body. Kind of "decorating" each jersey method inside this resource.
Is there an elegant solution? For example with jersey Provider?
Thx!