Package org.ldaptive
Class LdapURL
- java.lang.Object
-
- org.ldaptive.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LdapURL.Entry
Represents a single LDAP URL entry.
-
Field Summary
Fields Modifier and Type Field Description private static String
DEFAULT_DELIMITER
Default delimiter for ldap urls.private List<LdapURL.Entry>
ldapEntries
URL entries.static String
NO_DELIMITER
Do not split URL.private static Pattern
URL_PATTERN
Pattern to match LDAP URLs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<LdapURL.Entry>
getEntries()
Returns a list of all the ldap url entries in this ldap url.LdapURL.Entry
getEntry()
Returns the first entry of this ldap url.String[]
getHostnames()
Returns a list of all the hostnames in this ldap url.String[]
getHostnamesWithSchemeAndPort()
Returns a list of all the hostnames including their scheme and port in this ldap url.LdapURL.Entry
getLastEntry()
Returns the last entry of this ldap url.String[]
getUrls()
Returns a list of all the URLs in this ldap url.protected LdapURL.Entry
parseEntry(String url)
Matches the supplied url against a pattern and reads it's components.int
size()
Returns the number of entries in this ldap url.String
toString()
-
-
-
Field Detail
-
NO_DELIMITER
public static final String NO_DELIMITER
Do not split URL.- See Also:
- Constant Field Values
-
DEFAULT_DELIMITER
private static final String DEFAULT_DELIMITER
Default delimiter for ldap urls.- See Also:
- Constant Field Values
-
URL_PATTERN
private static final Pattern URL_PATTERN
Pattern to match LDAP URLs.
-
ldapEntries
private final List<LdapURL.Entry> ldapEntries
URL entries.
-
-
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
-
-