我之前已经看过这个主题,并且给出的解决方案有效。
但是,它不符合我的需要,因为它通过设置以下catalina.policy来授予对每个目录的读取访问权限:
grant {
permission java.security.AllPermission;
};
因此,我的问题是:有一种方法可以识别正在请求的文件或资源,但是当我取消此授权时被拒绝?
以下日志可能会有所帮助,并在删除给定的Grant时显示:
java.security.AccessControlException:访问被拒绝(java.security.SecurityPermission getProperty.package.definition)在java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)在java.security.AccessController.checkPermission(AccessController.java:546)在org.apache.catalina.security.SecurityConfig.setSecurityProperty(SecurityConfig.java:117)在java.security.Security.getProperty(Security.java:725)在java.lang.SecurityManager.checkPermission(SecurityManager.java:532)在位于org.apache.catalina.startup.Embedded.setSecurityProtection(Embedded.java:990)的org.apache.catalina.security.SecurityConfig.setPackageDefinition(SecurityConfig.java:106)在org.apache.catalina.startup.Embedded。(Embedded .java:130),位于org.apache.catalina.startup.Embedded(Embedded.java:115)在org.apache.catalina.startup.Catalina。(Catalina.java:58)在sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)在java.lang.Class.newInstance0(Class.java:355)在java.lang.reflect.Constructor.newInstance(Constructor.java:513)在java.lang.Class.newInstance0(Class.java:355)上reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:225)的.newInstance(Class.java:308)org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:410)的.newInstance(Class.java:308)java.lang.Class.newInstance0上java.lang.reflect.Constructor.newInstance(Constructor.java:513)上的sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)上的NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) (Class.java:355)在org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:225)在java.lang.Class.newInstance(Class.java:308)在org.apache.catalina.startup。 Bootstrap.main(Bootstrap.java:410)java.lang.Class.newInstance0上java.lang.reflect.Constructor.newInstance(Constructor.java:513)上的sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)上的NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) (Class.java:355)在org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:225)在java.lang.Class.newInstance(Class.java:308)在org.apache.catalina.startup Bootstrap.main(Bootstrap.java:410)308),位于org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:225),位于org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:410)308),位于org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:225),位于org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:410)
先感谢您!