Package org.ldaptive

Class LdapURL


  • public class LdapURL
    extends Object
    Utility class for parsing LDAP URLs. See RFC 4516. Supports a space delimited format for representing multiple URLs. Expects URLs of the form scheme://hostname:port/baseDn?attrs?scope?filter. This implementation does not support URL extensions.
    • Constructor Detail

      • LdapURL

        public LdapURL​(String url)
        Creates a new ldap url.
        Parameters:
        url - space delimited list of ldap urls
      • LdapURL

        public LdapURL​(String url,
                       String delimiter)
        Creates a new ldap url.
        Parameters:
        url - space delimited list of ldap urls
        delimiter - to split url with
    • Method Detail

      • parseEntry

        protected LdapURL.Entry parseEntry​(String url)
        Matches the supplied url against a pattern and reads it's components.
        Parameters:
        url - to parse
        Returns:
        entry
      • getEntry

        public LdapURL.Entry getEntry()
        Returns the first entry of this ldap url.
        Returns:
        first entry
      • getLastEntry

        public LdapURL.Entry getLastEntry()
        Returns the last entry of this ldap url.
        Returns:
        last entry
      • getEntries

        public List<LdapURL.Entry> getEntries()
        Returns a list of all the ldap url entries in this ldap url.
        Returns:
        ldap url entries
      • getUrls

        public String[] getUrls()
        Returns a list of all the URLs in this ldap url.
        Returns:
        ldap urls
      • getHostnamesWithSchemeAndPort

        public String[] getHostnamesWithSchemeAndPort()
        Returns a list of all the hostnames including their scheme and port in this ldap url.
        Returns:
        ldap url hostnames with scheme and port
      • getHostnames

        public String[] getHostnames()
        Returns a list of all the hostnames in this ldap url.
        Returns:
        ldap url hostnames
      • size

        public int size()
        Returns the number of entries in this ldap url.
        Returns:
        number of entries in this ldap url