Java SecurityManager getSecurityContext()方法与示例
SecurityManager类的getSecurityContext()方法 (SecurityManager Class getSecurityContext() method)
getSecurityContext() method is available in java.lang package.
getSecurityContext()方法在java.lang包中可用。
getSecurityContext() method is used to return an object that encapsulates or binds the current execution environment and we don't override this method so it returns an object of "AccessControlContext".
getSecurityContext()方法用于返回封装或绑定当前执行环境的对象,并且我们不会重写此方法,因此它返回“ AccessControlContext”对象。
getSecurityContext() method is required to determine whether the untrusted method is eligible to execute on its own or not.
需要getSecurityContext()方法来确定不受信任的方法是否有资格独立执行。
getSecurityContext() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
getSecurityContext()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
getSecurityContext() method does not throw an exception at the time returning an object of executing the environment.
getSecurityContext()方法在返回执行环境的对象时不会引发异常。
Syntax:
句法:
public Object getSecurityContext();
Parameter(s):
参数:
It does not accept any parameter.
它不接受任何参数。
Return value:
返回值:
The return type of this method is Object, it returns an object that encapsulates enough information of an environment executing currently to operate some security validations.
此方法的返回类型为Object ,它返回一个对象,该对象封装了当前正在执行的环境的足够信息,以进行某些安全性验证。
Example:
例:
// Java program to demonstrate the example
// of Object getSecurityContext() method of
// SecurityManager
import java.security.*;
public class GetSecurityContext {public static void main(String[] args) {// By using setProperty() method is to set the policy property
// with security manager
System.setProperty("java.security.policy", "file:/C:/java.policy");
// Instantiating a SecurityManager object
SecurityManager smgr = new SecurityManager();
// By using setSecurityManager() method is to set the
// security manager
System.setSecurityManager(smgr);
// By using getSecurityContext() method is to return the
// object of security context
Object ob = smgr.getSecurityContext();
// Display ob
System.out.println("Ob = " + ob);
}
}
Output
输出量
Ob = [email protected]
翻译自: https://www.includehelp.com/java/securitymanager-getsecuritycontext-method-with-example.aspx
Java SecurityManager getSecurityContext()方法与示例相关推荐
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
- java user directory,Java ProcessBuilder directory()方法与示例
语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...
- Java序列化魔术方法及其示例使用
在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...
- catalog java,Java Connection getCatalog()方法与示例
通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...
- filepermission java,Java FilePermission getActions()方法与示例
FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...
- java方法参数Bundle,Java ResourceBundle keySet()方法及示例
ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...
- java exec waitfor,Java Process waitFor()方法与示例
流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...
- java arraylist.add(),Java ArrayList add()方法与示例
ArrayList类add()方法 语法:public boolean add(T ele); public void add(int indices, T ele);add()方法在java.uti ...
- java rollback用法,Java Connection rollBack()方法与示例
回滚操作将撤消当前事务所做的所有更改,即,如果调用Connection接口的rollBack()方法,则所有修改都将还原到最后一次提交. 您还可以通过将所需的Savepoint对象作为参数传递给此方法 ...
最新文章
- php的方向,PHP面试方向
- [YTU]_2577( 小数计算——结构体)
- 地图图元的闪烁效果制作
- 预测一下web前端未来的6个趋势
- C语言中各数据类型和他们对应的最大值和最小值的常量
- 暴风影音内MEE引擎揭秘
- Lange电桥的设计
- python把int转为str_python中int与str互转方法
- itools电脑显示服务器维护,win10系统iTools无法打开且服务无法启动的具体技巧
- PYTHON单任务FTP断点续传程序
- 2021年中国人机界面软件市场趋势报告、技术动态创新及2027年市场预测
- Visual Studio Code安装及设置
- Android Studio Gradle打包实践之多渠道+版本号管理
- 通信专业实务(三)——接入网
- 【故障处理】队列等待之enq: TX - row lock contention
- 内地富豪香港理财遇血洗 知名地产商亏损百亿
- 电脑重启后,原本正常启动的ensp firewall usg6000无法正常启动--无限#号
- 购物平台全店商品爬虫案例
- 小学计算机老师师德师风演讲稿,小学教师师德师风演讲稿五篇
- Java multiplechoice,雅思听力八大题型之Multiple Choice题型篇
热门文章
- html中给div设置的属性怎么样才能拿得到_HTML与CSS结合的三种方式:优先级比较...
- 网络工程属于计算机哪一类,网络工程专业属于什么门类
- 【完成发布】Lazy Line Painter – 非常有趣的 jQuery 路径动画插件
- 题解 P2598 【[ZJOI2009]狼和羊的故事】
- Eclipse安装TestNG插件
- No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
- 选择排序和冒泡排序以及折半查找
- 【程序员感悟系列】 由一点业务说开去
- sqlserver中自定义函数+存储过程实现批量删除
- 平衡二叉树,AVL树之图解篇