📄 context.html
字号:
in the classpath. In addition, if the file <i>java.home</i><tt>/lib/jndi.properties</tt> exists and is readable, JNDI treats it as an additional application resource file. (<i>java.home</i> indicates the directory named by the <tt>java.home</tt> system property.) All of the properties contained in these files are placed into the environment of the initial context. This environment is then inherited by other contexts. <p> For each property found in more than one application resource file, JNDI uses the first value found or, in a few cases where it makes sense to do so, it concatenates all of the values (details are given below). For example, if the "java.naming.factory.object" property is found in three <tt>jndi.properties</tt> resource files, the list of object factories is a concatentation of the property values from all three files. Using this scheme, each deployable component is responsible for listing the factories that it exports. JNDI automatically collects and uses all of these export lists when searching for factory classes. <p> Application resource files are available beginning with the Java 2 Platform, except that the file in <i>java.home</i><tt>/lib</tt> may be used on earlier Java platforms as well. <h5>Search Algorithm for Properties</h5> When JNDI constructs an initial context, the context's environment is initialized with properties defined in the environment parameter passed to the constructor, the system properties, the applet parameters, and the application resource files. See <a href=InitialContext.html#ENVIRONMENT><tt>InitialContext</tt></a> for details. This initial environment is then inherited by other context instances. <p> When the JNDI class library needs to determine the value of a property, it does so by merging the values from the following two sources, in order: <ol> <li>The environment of the context being operated on. <li>The provider resource file (<tt>jndiprovider.properties</tt>) for the context being operated on. </ol> For each property found in both of these two sources, JNDI determines the property's value as follows. If the property is one of the standard JNDI properties that specify a list of JNDI factories (listed <a href=#LISTPROPS>above</a>), the values are concatenated into a single colon-separated list. For other properties, only the first value found is used. <p> When a service provider needs to determine the value of a property, it will generally take that value directly from the environment. A service provider may define provider-specific properties to be placed in its own provider resource file. In that case it should merge values as described in the previous paragraph. <p> In this way, each service provider developer can specify a list of factories to use with that service provider. These can be modified by the application resources specified by the deployer of the application or applet, which in turn can be modified by the user.<P><DL><DT><B>Since: </B><DD>1.3</DD></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#APPLET">APPLET</A></B></CODE><BR> Constant that holds the name of the environment property for specifying an applet for the initial context constructor to use when searching for other properties.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#AUTHORITATIVE">AUTHORITATIVE</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the authoritativeness of the service requested.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#BATCHSIZE">BATCHSIZE</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the batch size to use when returning data via the service's protocol.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#DNS_URL">DNS_URL</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the DNS host and domain names to use for the JNDI URL context (for example, "dns://somehost/wiz.com").</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#INITIAL_CONTEXT_FACTORY">INITIAL_CONTEXT_FACTORY</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the initial context factory to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#LANGUAGE">LANGUAGE</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the preferred language to use with the service.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#OBJECT_FACTORIES">OBJECT_FACTORIES</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the list of object factories to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#PROVIDER_URL">PROVIDER_URL</A></B></CODE><BR> Constant that holds the name of the environment property for specifying configuration information for the service provider to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#REFERRAL">REFERRAL</A></B></CODE><BR> Constant that holds the name of the environment property for specifying how referrals encountered by the service provider are to be processed.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#SECURITY_AUTHENTICATION">SECURITY_AUTHENTICATION</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the security level to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#SECURITY_CREDENTIALS">SECURITY_CREDENTIALS</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the credentials of the principal for authenticating the caller to the service.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#SECURITY_PRINCIPAL">SECURITY_PRINCIPAL</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the identity of the principal for authenticating the caller to the service.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#SECURITY_PROTOCOL">SECURITY_PROTOCOL</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the security protocol to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#STATE_FACTORIES">STATE_FACTORIES</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the list of state factories to use.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#URL_PKG_PREFIXES">URL_PKG_PREFIXES</A></B></CODE><BR> Constant that holds the name of the environment property for specifying the list of package prefixes to use when loading in URL context factories.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/naming/Context.html#addToEnvironment(java.lang.String, java.lang.Object)">addToEnvironment</A></B>(<A HREF="../../java/lang/String.html">String</A> propName, <A HREF="../../java/lang/Object.html">Object</A> propVal)</CODE><BR> Adds a new environment property to the environment of this context.</TD></TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -