public class LdapURL
extends java.lang.Object
The RFC2255 representation of an LDAP URL is defined using the following grammar:
ldapurl = scheme "://" [hostport] ["/"
[dn ["?" [attributes] ["?" [scope]
["?" [filter] ["?" extensions]]]]]]
scheme = "ldap"
attributes = attrdesc *("," attrdesc)
scope = "base" / "one" / "sub"
dn = distinguishedName
hostport = hostport
attrdesc = AttributeDescription
filter = filter
extensions = extension *("," extension)
extension = ["!"] extype ["=" exvalue]
extype = token / xtoken
exvalue = LDAPString
token = oid
xtoken = ("X-" / "x-") token
Refer to RFC 2255 for the complete definition of an LDAP URL.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
attributes
The attributes component of an LDAP URL.
|
protected Name |
dn
The dn component of an LDAP URL.
|
protected java.lang.String |
extensions
The extensions component of an LDAP URL.
|
protected java.lang.String |
filter
The filter component of an LDAP URL.
|
protected java.lang.String |
host
The host component of an LDAP URL.
|
protected int |
port
The port component of an LDAP URL.
|
protected java.lang.String |
scheme
The scheme component of an LDAP URL.
|
protected int |
scope
The scope component of an LDAP URL.
|
static int |
SCOPE_BASE
Scope mode base.
|
static int |
SCOPE_ONE
Scope mode one.
|
static int |
SCOPE_SUB
Scope mode sub.
|
| Constructor and Description |
|---|
LdapURL(java.lang.String url)
Creates an
LdapURL object by parsing the given
String representing an LDAP URL, and extracting its components. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAttributes()
Retrieves the
attributes component of the LDAP URL. |
Name |
getDN()
Retrieves the DN component of the LDAP URL.
|
java.lang.String |
getExtensions()
Retrieves the
extensions component of the LDAP URL. |
java.lang.String |
getFilter()
Retrieves the
filter component of the LDAP URL. |
java.lang.String |
getHost()
Retrieves the
host component of the LDAP URL. |
int |
getPort()
Retrieves the
port component of the LDAP URL. |
java.lang.String |
getScheme()
Retrieves the
scheme component of the LDAP URL. |
int |
getScope()
Retrieves the
scope component of the LDAP URL. |
boolean |
isEmpty()
Determines whether this
LdapURL object is empty. |
boolean |
isLdapURL()
Determines whether the
String contained in this object
is an LDAP URL. |
static boolean |
isLdapURL(java.lang.String url)
Determines whether the input
String is an LDAP URL. |
java.lang.String |
toString()
Provides the
String representation of an LDAP URL. |
public static final int SCOPE_BASE
public static final int SCOPE_ONE
public static final int SCOPE_SUB
protected java.lang.String scheme
protected java.lang.String host
protected int port
protected Name dn
protected java.lang.String attributes
protected int scope
protected java.lang.String filter
protected java.lang.String extensions
public LdapURL(java.lang.String url)
throws java.lang.Exception
LdapURL object by parsing the given
String representing an LDAP URL, and extracting its components.url - a String representing an LDAP URL according to
RFC 2255.
Must not be null.java.lang.Exception - if a parsing error occurspublic java.lang.String getScheme()
scheme component of the LDAP URL.scheme component or
null if the scheme component
does not exist.public java.lang.String getHost()
host component of the LDAP URL.host component or
null if the host component does
not exist.public int getPort()
port component of the LDAP URL.port component or the default
port number if no port number is specified.public Name getDN()
null if the DN
component does not exist.public java.lang.String getAttributes()
attributes component of the LDAP URL.attributes component or
null if the attributes component
does not exist.public int getScope()
scope component of the LDAP URL.scope component, or the default
value base if no scope value
is specified.public java.lang.String getFilter()
filter component of the LDAP URL.filter component, or
(objectclass=*) if no filter
value is specified.public java.lang.String getExtensions()
extensions component of the LDAP URL.extensions component, or
null if the extensions component
does not exist.public static boolean isLdapURL(java.lang.String url)
String is an LDAP URL.
According to RFC 2255
an LDAP URL must start with "ldap://". However, the toolkit
will also allow the scheme to be case insensitive as recommended by
RFC 1738:
'For resiliency, programs interpreting URLs should treat upper case letters as equivalent to lower case in scheme names (e.g., allow "HTTP" as well as "http")'.
url - the string to be tested must not be nulltrue if the String is
an LDAP URL, false otherwise.public boolean isLdapURL()
String contained in this object
is an LDAP URL.
According to RFC 2255
an LDAP URL must start with "ldap://".
true if this object contains an LDAP URL,
false otherwise.public java.lang.String toString()
String representation of an LDAP URL.toString in class java.lang.ObjectString.public boolean isEmpty()
LdapURL object is empty.
An LDAP URL is empty if its host and DN components are
both null.
true if the LDAP URL is empty,
false otherwise.