The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.naming  [9 examples]

e479. Parsing a JNDI Composite Name

In the composite name space, forward-slash (/) separates the composite components.
    try {
        CompositeName composite = new CompositeName(
            "cn=John,o=hits/report/summary.txt");
        String first = composite.get(0);                  // cn=John,o=hits
        String last = composite.get(composite.size()-1);  // summary.txt
    
        composite.add(0, "wiz.com"); // wiz.com/cn=John,o=hits/report/summary.txt
        composite.remove(2);         // wiz.com/cn=John,o=hits/summary.txt
    } catch (NamingException e) {
    }

 Related Examples
e472. Creating an Initial Context to the Naming Service
e473. Looking Up an Object from the Naming Service
e474. Listing a Context in the Naming Service
e475. Adding, Replacing, Removing, and Renaming a Binding in the Naming Service
e476. Creating and Destroying a Subcontext in the Naming Service
e477. Getting an Object's Fully Qualified Name
e478. Using a URL as a Name to the Initial Context
e480. Parsing a JNDI Compound Name


© 2002 Addison-Wesley.