我编写了一个类扩展 ContainerRequestFilter 以进行权限检查。如何获取匹配方法的注释以进行权限检查。
@javax.ws.rs.ext.Provider
public class AuthorizationRequestFilter implements ContainerRequestFilter {
public void filter(ContainerRequestContext requestContext) throws IOException {
// how can I get resources' methods' annotation here?
// from the resource below , I want to checkout whether the target matched method contains the @ReadPermission annotation
}
}
@Path("/region")
public class Region {
@POST
@Path("/{region_id}")
@Produces({MediaType.APPLICATION_JSON , MediaType.APPLICATION_XML})
@ReadPermission
public String getRegion() {
return null;
}
}
Run Code Online (Sandbox Code Playgroud)