Class LDAPUtil


  • public class LDAPUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SPECIAL_CHARS  
    • Constructor Summary

      Constructors 
      Constructor Description
      LDAPUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String escapeFilter​(java.lang.Object object)
      This method escapes special characters for LDAP filter (RFC 4515).
      static java.lang.String escapeRDNValue​(java.lang.Object value)
      This method escapes special characters for LDAP DN (RFC 1779).
      static java.lang.String escapeRDNValue​(java.lang.String value, boolean doubleEscape)  
      static netscape.ldap.LDAPControl getControl​(java.lang.Class<? extends netscape.ldap.LDAPControl> cls, netscape.ldap.LDAPControl[] controls)
      Get the control of the specified class from the array of controls.
      static void importLDIF​(netscape.ldap.LDAPConnection conn, java.lang.String filename, java.util.ArrayList<java.lang.String> errors)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SPECIAL_CHARS

        public static java.lang.String SPECIAL_CHARS
    • Constructor Detail

      • LDAPUtil

        public LDAPUtil()
    • Method Detail

      • escapeFilter

        public static java.lang.String escapeFilter​(java.lang.Object object)
        This method escapes special characters for LDAP filter (RFC 4515). Each special character will be replaced by a backslash followed by 2-digit hex of the ASCII code.
        Parameters:
        object - string to escape
        Returns:
        escaped string
      • escapeRDNValue

        public static java.lang.String escapeRDNValue​(java.lang.Object value)
        This method escapes special characters for LDAP DN (RFC 1779).
      • escapeRDNValue

        public static java.lang.String escapeRDNValue​(java.lang.String value,
                                                      boolean doubleEscape)
      • importLDIF

        public static void importLDIF​(netscape.ldap.LDAPConnection conn,
                                      java.lang.String filename,
                                      java.util.ArrayList<java.lang.String> errors)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • getControl

        public static netscape.ldap.LDAPControl getControl​(java.lang.Class<? extends netscape.ldap.LDAPControl> cls,
                                                           netscape.ldap.LDAPControl[] controls)
        Get the control of the specified class from the array of controls.
        Returns:
        the LDAPControl, or null if not found