本文整理汇总了Java中java.security.Permissions.setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java Permissions.setReadOnly方法的具体用法?Java Permissions.setReadOnly怎么用?Java Permissions.setReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.Permissions
的用法示例。
在下文中一共展示了Permissions.setReadOnly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRestrictedPermissions
import java.security.Permissions; //导入方法依赖的package包/类
static PermissionCollection getRestrictedPermissions() {
Permissions perms = new Permissions();
// property/env access needed for parsing
perms.add(new PropertyPermission("*", "read"));
perms.add(new RuntimePermission("getenv.TIKA_CONFIG"));
// add permissions for resource access:
// classpath
addReadPermissions(perms, JarHell.parseClassPath());
// plugin jars
if (TikaImpl.class.getClassLoader() instanceof URLClassLoader) {
addReadPermissions(perms, ((URLClassLoader)TikaImpl.class.getClassLoader()).getURLs());
}
// jvm's java.io.tmpdir (needs read/write)
perms.add(new FilePermission(System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + "-",
"read,readlink,write,delete"));
// current hacks needed for POI/PDFbox issues:
perms.add(new SecurityPermission("putProviderProperty.BC"));
perms.add(new SecurityPermission("insertProvider"));
perms.add(new ReflectPermission("suppressAccessChecks"));
// xmlbeans, use by POI, needs to get the context classloader
perms.add(new RuntimePermission("getClassLoader"));
perms.setReadOnly();
return perms;
}
示例2: getPermissions
import java.security.Permissions; //导入方法依赖的package包/类
@Override
protected PermissionCollection getPermissions(CodeSource codeSource) {
Permissions perms = new Permissions();
perms.add(new AllPermission());
perms.setReadOnly();
return perms;
}
示例3: SystemClassLoader
import java.security.Permissions; //导入方法依赖的package包/类
public SystemClassLoader(List<File> files, ClassLoader[] parents, Set<Module> modules) throws IllegalArgumentException {
super(files, parents, false);
allPermissions = new Permissions();
allPermissions.add(new AllPermission());
allPermissions.setReadOnly();
size = modules.size();
}
示例4: getPermissions
import java.security.Permissions; //导入方法依赖的package包/类
protected PermissionCollection getPermissions(CodeSource codesource) {
Permissions permissions = new Permissions();
permissions.add(new AllPermission());
permissions.setReadOnly();
return permissions;
}