⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 securitymanager.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Tests if there is a security check in progress.<DD><DL><DT><B>Returns:</B><DD>the value of the <code>inCheck</code> field. This field           should contain <code>true</code> if a security check is          in progress,          <code>false</code> otherwise.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#inCheck"><CODE>inCheck</CODE></A></DL></DD></DL><HR><A NAME="getClassContext()"><!-- --></A><H3>getClassContext</H3><PRE>protected <A HREF="../../java/lang/Class.html">Class</A>[] <B>getClassContext</B>()</PRE><DL><DD>Returns the current execution stack as an array of classes.  <p> The length of the array is the number of methods on the execution  stack. The element at index <code>0</code> is the class of the  currently executing method, the element at index <code>1</code> is  the class of that method's caller, and so on.<DD><DL><DT><B>Returns:</B><DD>the execution stack.</DL></DD></DL><HR><A NAME="currentClassLoader()"><!-- --></A><H3>currentClassLoader</H3><PRE>protected <A HREF="../../java/lang/ClassLoader.html">ClassLoader</A> <B>currentClassLoader</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This type of security checking is not recommended.  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Returns the class loader of the most recently executing method from a class defined using a non-system class loader. A non-system  class loader is defined as being a class loader that is not equal to the system class loader (as returned  by <A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()"><CODE>ClassLoader.getSystemClassLoader()</CODE></A>) or one of its ancestors. <p> This method will return <code>null</code> in the following three cases:<p> <ol>   <li>All methods on the execution stack are from classes   defined using the system class loader or one of its ancestors.   <li>All methods on the execution stack up to the first   "privileged" caller    (see <A HREF="../../java/security/AccessController.html#doPrivileged(java.security.PrivilegedAction)"><CODE>AccessController.doPrivileged(java.security.PrivilegedAction)</CODE></A>)   are from classes   defined using the system class loader or one of its ancestors.   <li> A call to <code>checkPermission</code> with    <code>java.security.AllPermission</code> does not    result in a SecurityException.  </ol><DD><DL><DT><B>Returns:</B><DD>the class loader of the most recent occurrence on the stack          of a method from a class defined using a non-system class           loader.<DT><B>See Also: </B><DD><A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()"><CODE>getSystemClassLoader</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkPermission(java.security.Permission)"><CODE>checkPermission</CODE></A></DL></DD></DL><HR><A NAME="currentLoadedClass()"><!-- --></A><H3>currentLoadedClass</H3><PRE>protected <A HREF="../../java/lang/Class.html">Class</A> <B>currentLoadedClass</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This type of security checking is not recommended.  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Returns the class of the most recently executing method from a class defined using a non-system class loader. A non-system  class loader is defined as being a class loader that is not equal to the system class loader (as returned  by <A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()"><CODE>ClassLoader.getSystemClassLoader()</CODE></A>) or one of its ancestors. <p> This method will return <code>null</code> in the following three cases:<p> <ol>   <li>All methods on the execution stack are from classes   defined using the system class loader or one of its ancestors.   <li>All methods on the execution stack up to the first   "privileged" caller   (see <A HREF="../../java/security/AccessController.html#doPrivileged(java.security.PrivilegedAction)"><CODE>AccessController.doPrivileged(java.security.PrivilegedAction)</CODE></A>)   are from classes   defined using the system class loader or one of its ancestors.   <li> A call to <code>checkPermission</code> with    <code>java.security.AllPermission</code> does not    result in a SecurityException.  </ol><DD><DL><DT><B>Returns:</B><DD>the class  of the most recent occurrence on the stack          of a method from a class defined using a non-system class           loader.<DT><B>See Also: </B><DD><A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()"><CODE>getSystemClassLoader</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkPermission(java.security.Permission)"><CODE>checkPermission</CODE></A></DL></DD></DL><HR><A NAME="classDepth(java.lang.String)"><!-- --></A><H3>classDepth</H3><PRE>protected int <B>classDepth</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;name)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This type of security checking is not recommended.  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Returns the stack depth of the specified class.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the fully qualified name of the class to search for.<DT><B>Returns:</B><DD>the depth on the stack frame of the first occurrence of a          method from a class with the specified name;          <code>-1</code> if such a frame cannot be found.</DL></DD></DL><HR><A NAME="classLoaderDepth()"><!-- --></A><H3>classLoaderDepth</H3><PRE>protected int <B>classLoaderDepth</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This type of security checking is not recommended.  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Returns the stack depth of the most recently executing method  from a class defined using a non-system class loader.  A non-system  class loader is defined as being a class loader that is not equal to the system class loader (as returned  by <A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()"><CODE>ClassLoader.getSystemClassLoader()</CODE></A>) or one of its ancestors. <p> This method will return -1 in the following three cases:<p> <ol>   <li>All methods on the execution stack are from classes   defined using the system class loader or one of its ancestors.   <li>All methods on the execution stack up to the first   "privileged" caller   (see <A HREF="../../java/security/AccessController.html#doPrivileged(java.security.PrivilegedAction)"><CODE>AccessController.doPrivileged(java.security.PrivilegedAction)</CODE></A>)   are from classes   defined using the system class loader or one of its ancestors.   <li> A call to <code>checkPermission</code> with    <code>java.security.AllPermission</code> does not    result in a SecurityException.  </ol><DD><DL><DT><B>Returns:</B><DD>the depth on the stack frame of the most recent occurrence of          a method from a class defined using a non-system class loader.<DT><B>See Also: </B><DD><A HREF="../../java/lang/ClassLoader.html#getSystemClassLoader()"><CODE>getSystemClassLoader</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkPermission(java.security.Permission)"><CODE>checkPermission</CODE></A></DL></DD></DL><HR><A NAME="inClass(java.lang.String)"><!-- --></A><H3>inClass</H3><PRE>protected boolean <B>inClass</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;name)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This type of security checking is not recommended.  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Tests if a method from a class with the specified         name is on the execution stack.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the fully qualified name of the class.<DT><B>Returns:</B><DD><code>true</code> if a method from a class with the specified         name is on the execution stack; <code>false</code> otherwise.</DL></DD></DL><HR><A NAME="inClassLoader()"><!-- --></A><H3>inClassLoader</H3><PRE>protected boolean <B>inClassLoader</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>This type of security checking is not recommended.  It is recommended that the <code>checkPermission</code>  call be used instead.</I><P><DD>Basically, tests if a method from a class defined using a          class loader is on the execution stack.<DD><DL><DT><B>Returns:</B><DD><code>true</code> if a call to <code>currentClassLoader</code>          has a non-null return value.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#currentClassLoader()"><CODE>currentClassLoader</CODE></A></DL></DD></DL><HR><A NAME="getSecurityContext()"><!-- --></A><H3>getSecurityContext</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>getSecurityContext</B>()</PRE><DL><DD>Creates an object that encapsulates the current execution  environment. The result of this method is used, for example, by the  three-argument <code>checkConnect</code> method and by the  two-argument <code>checkRead</code> method.  These methods are needed because a trusted method may be called  on to read a file or open a socket on behalf of another method.  The trusted method needs to determine if the other (possibly  untrusted) method would be allowed to perform the operation on its  own.  <p> The default implementation of this method is to return  an <code>AccessControlContext</code> object.<DD><DL><DT><B>Returns:</B><DD>an implementation-dependent object that encapsulates          sufficient information about the current execution environment          to perform some security checks later.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkConnect(java.lang.String, int, java.lang.Object)"><CODE>checkConnect</CODE></A>, <A HREF="../../java/lang/SecurityManager.html#checkRead(java.lang.String, java.lang.Object)"><CODE>checkRead</CODE></A>, <A HREF="../../java/security/AccessControlContext.html"><CODE>AccessControlContext</CODE></A></DL></DD></DL><HR><A NAME="checkPermission(java.security.Permission)"><!-- --></A><H3>checkPermission</H3><PRE>public void <B>checkPermission</B>(<A HREF="../../java/security/Permission.html">Permission</A>&nbsp;perm)</PRE><DL><DD>Throws a <code>SecurityException</code> if the requested access, specified by the given permission, is not permitted based on the security policy currently in effect. <p> This method calls <code>AccessController.checkPermission</code>  with the given permission.<DD><DL><DT><B>Parameters:</B><DD><CODE>perm</CODE> - the requested permission.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if access is not permitted based on		  the current security policy.<DD><CODE><A HREF="../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the permission argument is            <code>null</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="checkPermission(java.security.Permission, java.lang.Object)"><!-- --></A><H3>checkPermission</H3><PRE>public void <B>checkPermission</B>(<A HREF="../../java/security/Permission.html">Permission</A>&nbsp;perm,                            <A HREF="../../java/lang/Object.html">Object</A>&nbsp;context)</PRE><DL><DD>Throws a <code>SecurityException</code> if the specified security context is denied access to the resource specified by the given permission. The context must be a security  context returned by a previous call to  <code>getSecurityContext</code> and the access control decision is based upon the configured security policy for that security context. <p> If <code>context</code> is an instance of  <code>AccessControlContext</code> then the <code>AccessControlContext.checkPermission</code> method is invoked with the specified permission.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -