Parsing a JNDI Composite Name : Name « JNDI LDAP « Java

Parsing a JNDI Composite Name


import javax.naming.CompositeName;

public class Main {
  public static void main(String[] argv) throws Exception {

    CompositeName composite = new CompositeName("cn=John,o=hits/summary.txt");
    String first = composite.get(0);
    String last = composite.get(composite.size() - 1); 

    composite.add(0, ""); 


Related examples in the same category

1.Getting an Object's Fully Qualified Name
2.Using a URL as a Name to the Initial Context
3.Parsing a JNDI Compound Name
4.Show only the common name (cn) and e-mail address (mail) attributes
5.Replace the placeholders in the filter with the proper values from the userName