Jersey 2.x Security context does not work?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: While i am trying to create java jersey application authentication roles does not work for me. Java code :- package org.student.resource; import javax.annotation.security.PermitAll; import javax.annotation.security.RolesAllowed; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.ext.Provider; @Path("/resource") @PermitAll public class Resource { @GET public String get(){ return "GET"; } @RolesAllowed("admin") @POST public String post(){ return "Post content."; } } Deployment descriptor :- <web-app