Context: getNameInNamespace() : Context « javax.naming « Java by API






Context: getNameInNamespace()

   
import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;

public class Main {
  public static void main(String[] argv) throws Exception {
    String url = "iiop://localhost/";
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put(Context.PROVIDER_URL, url);

    Context ctx = new InitialContext(env);
    // Create a subcontext.
    Context childCtx = ctx.createSubcontext("child");

    // Destroy the subcontext.
    ctx.destroySubcontext("child");

    Context obj = (Context) childCtx.lookup("grandChild");
    String fullname = obj.getNameInNamespace();
  }
}

   
    
    
  








Related examples in the same category

1.Context.INITIAL_CONTEXT_FACTORY
2.Context.PROVIDER_URL
3.Context.SECURITY_AUTHENTICATION
4.Context.SECURITY_CREDENTIALS
5.Context.SECURITY_PRINCIPAL
6.Context: addToEnvironment(String propName, Object propVal)
7.Context: close()
8.Context: createSubcontext(String name)
9.Context: destroySubcontext(String name)
10.Context: getNameParser(String name)
11.Context: listBindings(String name)
12.Context: lookup(String name)
13.Context: rename(String oldName, String newName)
14.Context: unbind(String name)