Example usage for javax.naming.ldap LdapName getSuffix

List of usage examples for javax.naming.ldap LdapName getSuffix

Introduction

In this page you can find the example usage for javax.naming.ldap LdapName getSuffix.

Prototype

public Name getSuffix(int posn) 

Source Link

Document

Creates a name whose components consist of a suffix of the components in this LDAP name.

Usage

From source file:LdapNameSuffixPrefix.java

public static void main(String args[]) {
    String name = "cn=Mango, ou=Fruits, o=Food";
    try {//  w w  w. j a  va 2s  .  c  o  m
        LdapName dn = new LdapName(name);
        Name suffix = dn.getSuffix(1); // 1 <= index < cn.size()
        Name prefix = dn.getPrefix(1); // 0 <= index < 1
        System.out.println(suffix);
        System.out.println(prefix);
    } catch (InvalidNameException e) {
        System.out.println("Cannot parse name: " + name);
    }
}