What is Contex Environment in JNDI ?

Discussion in 'JNDI' started by SoCoooollllllllllllllllll, Dec 13, 2008.

  1. A Context's environment is represented as a java.util.Hashtable or any of its subclasses (e.g., java.util.Properties). It is typically specified using an argument to the InitialContext , InitialDirContext , or InitialLdapContext constructors, and augmented with data from other sources. They are inherited from the parent context as context methods proceed from one context to the next. For example, the following code creates an environment consisting of two security-related properties and creates an initial context using that environment.

    Hashtable env = new Hashtable();
    env.put(Context.SECURITY_PRINCIPAL, "Rajanikant");
    env.put(Context.SECURITY_CREDENTIALS, "Admin");
    Context ctx = new InitialContext(env);

    Contexts that are looked up or otherwise derived from this initial context will have these two properties in their environment.

    A Context's environment can be examined using Context.getEnvironment() .

    Note : All environment properties are meaningful to all contexts. Those that are not meaningful are ignored by the context but inherited by derived contexts.
  2. anneroberts

    anneroberts Member

    When the constructor may be called, those JNDI constructs an earth as stated by these decides What's more passes those come about of the underlying administration supplier. At you conjure systems that acquire connection Questions inferred starting with the introductory context, for example, such that connection. Lookup()(in the API reference documentation), nature's domain of the guardian setting may be inherited.

Share This Page