📄 policycontext.html
字号:
<!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="setContextID(java.lang.String)"><!-- --></A><H3>setContextID</H3><PRE>public static void <B>setContextID</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> contextID)</PRE><DL><DD>Authorization protected method used to modify the value of the policy context identifier associated with the thread on which this method is called.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>contextID</CODE> - a <code>String</code> that represents the value of the policy context identifier to be assigned to the PolicyContext for the calling thread. The value <code>null </code> is a legitimate value for this parameter.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/SecurityException.html" title="class or interface in java.lang">SecurityException</A></CODE> - if the calling AccessControlContext is not authorized by the container to call this method.</DL></DD></DL><HR><A NAME="getContextID()"><!-- --></A><H3>getContextID</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getContextID</B>()</PRE><DL><DD>This static method returns the value of the policy context identifier associated with the thread on which the accessor is called.<P><DD><DL><DT><B>Returns:</B><DD>The <code>String</code> (or <code>null</code>) policy context identifier established for the thread. This method must return the default policy context identifier, <code>null</code>, if the policy context identifier of the thread has not been set via <code>setContext</code> to another value.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/SecurityException.html" title="class or interface in java.lang">SecurityException</A></CODE> - if the calling AccessControlContext is not authorized by the container to call this method. Containers may choose to authorize calls to this method by any AccessControlContext.</DL></DD></DL><HR><A NAME="setHandlerData(java.lang.Object)"><!-- --></A><H3>setHandlerData</H3><PRE>public static void <B>setHandlerData</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> data)</PRE><DL><DD>Authorization protected method that may be used to associate a thread-scoped handler data object with the PolicyContext. The handler data object will be made available to handlers, where it can serve to supply or bind the handler to invocation scoped state within the container.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>data</CODE> - a container-specific object that will be associated with the calling thread and passed to any handler activated by a <code>Policy</code> provider (on the thread). The value <code>null</code> is a legitimate value for this parameter, and is the value that will be used in the activation of handlers if the <code>setHandlerData</code> has not been called on the thread.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/SecurityException.html" title="class or interface in java.lang">SecurityException</A></CODE> - if the calling AccessControlContext is not authorized by the container to call this method.</DL></DD></DL><HR><A NAME="registerHandler(java.lang.String, javax.security.jacc.PolicyContextHandler, boolean)"><!-- --></A><H3>registerHandler</H3><PRE>public static void <B>registerHandler</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> key, <A HREF="../../../javax/security/jacc/PolicyContextHandler.html" title="interface in javax.security.jacc">PolicyContextHandler</A> handler, boolean replace) throws <A HREF="../../../javax/security/jacc/PolicyContextException.html" title="class in javax.security.jacc">PolicyContextException</A></PRE><DL><DD>Authorization protected method used to register a container specific <code>PolicyContext</code> handler. A handler may be registered to handle multiple keys, but at any time, at most one handler may be registered for a key.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - a (case-sensitive) <code>String</code> that identifies the context object handled by the handler. The value of this parameter must not be null.<DD><CODE>handler</CODE> - an object that implements the <code>PolicyContextHandler</code> interface. The value of this parameter must not be null.<DD><CODE>replace</CODE> - this boolean value defines the behavior of this method if, when it is called, a <code>PolicyContextHandler</code> has already been registered to handle the same key. In that case, and if the value of this argument is <code>true</code>, the existing handler is replaced with the argument handler. If the value of this parameter is false the existing registration is preserved and an exception is thrown.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if the value of either of the handler or key arguments is null, or the value of the replace argument is <code>false</code> and a handler with the same key as the argument handler is already registered.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/SecurityException.html" title="class or interface in java.lang">SecurityException</A></CODE> - if the calling AccessControlContext is not authorized by the container to call this method.<DD><CODE><A HREF="../../../javax/security/jacc/PolicyContextException.html" title="class in javax.security.jacc">PolicyContextException</A></CODE> - if an operation by this method on the argument PolicyContextHandler causes it to throw a checked exception that is not accounted for in the signature of this method.</DL></DD></DL><HR><A NAME="getHandlerKeys()"><!-- --></A><H3>getHandlerKeys</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A> <B>getHandlerKeys</B>()</PRE><DL><DD>This method may be used to obtain the keys that identify the container specific context handlers registered by the container.<P><DD><DL><DT><B>Returns:</B><DD>A <code>Set</code>, the elements of which, are the <code>String</code> key values that identify the handlers that have been registered and therefore may be activated on the <code>PolicyContext</code>.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/SecurityException.html" title="class or interface in java.lang">SecurityException</A></CODE> - if the calling AccessControlContext is not authorized by the container to call this method. Containers may choose to authorize calls to this method by any AccessControlContext.</DL></DD></DL><HR><A NAME="getContext(java.lang.String)"><!-- --></A><H3>getContext</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getContext</B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> key) throws <A HREF="../../../javax/security/jacc/PolicyContextException.html" title="class in javax.security.jacc">PolicyContextException</A></PRE><DL><DD>This method may be used by a <code>Policy</code> provider to activate the <code>PolicyContextHandler</code> registered to the context object key and cause it to return the corresponding policy context object from the container. When this method activates a handler, it passes to the handler the context object key and the handler data associated with the calling thread.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - a <code>String</code> that identifies the <code>PolicyContextHandler</code> to activate and the context object to be acquired from the handler. The value of this parameter must not be null.<DT><B>Returns:</B><DD>the container and handler specific object containing the desired context. A <code>null</code> value is returned if the corresponding handler has been registered, and the value of the corresponding context is null.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if a <code>PolicyContextHandler</code> has not been registered for the key or the registered handler no longer supports the key.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/SecurityException.html" title="class or interface in java.lang">SecurityException</A></CODE> - if the calling AccessControlContext is not authorized by the container to call this method.<DD><CODE><A HREF="../../../javax/security/jacc/PolicyContextException.html" title="class in javax.security.jacc">PolicyContextException</A></CODE> - if an operation by this method on the identified PolicyContextHandler causes it to throw a checked exception that is not accounted for in the signature of this method.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/security/jacc/PolicyConfigurationFactory.html" title="class in javax.security.jacc"><B>PREV CLASS</B></A> <A HREF="../../../javax/security/jacc/PolicyContextException.html" title="class in javax.security.jacc"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/security/jacc/PolicyContext.html" target="_top"><B>FRAMES</B></A> <A HREF="PolicyContext.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../legal/license.html" target="_top">license terms.</a></font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -