public class LdapUrl extends Object
ldapurl = scheme "://" [hostport] ["/" [dn ["?" [attributes] ["?" [scope] ["?" [filter] ["?" extensions]]]]]] scheme = "ldap" attributes = attrdesc *("," attrdesc) scope = "base" / "one" / "sub" dn = Dn hostport = hostport from Section 5 of RFC 1738 attrdesc = AttributeDescription from Section 4.1.5 of RFC 2251 filter = filter from Section 4 of RFC 2254 extensions = extension *("," extension) extension = ["!"] extype ["=" exvalue] extype = token / xtoken exvalue = LDAPString token = oid from section 4.1 of RFC 2252 xtoken = ("X-" / "x-") token
Modifier and Type | Class and Description |
---|---|
static class |
LdapUrl.Extension
An inner bean to hold extension information.
|
Modifier and Type | Field and Description |
---|---|
static LdapUrl |
EMPTY_URL
A null LdapUrl
|
static String |
LDAP_SCHEME
The constant for "ldap://" scheme.
|
static String |
LDAPS_SCHEME
The constant for "ldaps://" scheme.
|
Constructor and Description |
---|
LdapUrl()
Construct an empty LdapUrl
|
LdapUrl(String string)
Create a new LdapUrl from a String after having parsed it.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
List<String> |
getAttributes() |
byte[] |
getBytesCopy() |
byte[] |
getBytesReference() |
Dn |
getDn() |
LdapUrl.Extension |
getExtension(String type)
Gets the extension.
|
List<LdapUrl.Extension> |
getExtensions() |
String |
getExtensionValue(String type)
Gets the extension value.
|
String |
getFilter() |
String |
getHost() |
int |
getNbBytes() |
int |
getPort() |
String |
getScheme() |
SearchScope |
getScope()
|
String |
getString() |
int |
hashCode() |
void |
setAttributes(List<String> attributes)
Sets the attributes, null removes all existing attributes.
|
void |
setDn(Dn dn)
Sets the dn.
|
void |
setFilter(String filter)
Sets the filter.
|
void |
setForceScopeRendering(boolean forceScopeRendering)
If set to true forces the toString method to render the scope
regardless of optional nature.
|
void |
setHost(String host)
Sets the host.
|
void |
setPort(int port)
Sets the port.
|
void |
setScheme(String scheme)
Sets the scheme.
|
void |
setScope(int scope)
Sets the scope.
|
void |
setScope(SearchScope scope)
Sets the scope.
|
String |
toString()
Get a string representation of a LdapUrl.
|
static String |
urlEncode(String url,
boolean doubleEncode)
Encode a String to avoid special characters.
|
public static final String LDAPS_SCHEME
public static final String LDAP_SCHEME
public LdapUrl()
public LdapUrl(String string) throws LdapURLEncodingException
string
- TheString that contains the LdapUrlLdapURLEncodingException
- If the String does not comply with RFC 2255public static String urlEncode(String url, boolean doubleEncode)
url
- The String to encodedoubleEncode
- Set if we need to encode the commapublic String toString()
toString
in class Object
forceScopeRendering
public List<String> getAttributes()
public List<LdapUrl.Extension> getExtensions()
public LdapUrl.Extension getExtension(String type)
type
- the extension type, case-insensitivepublic String getExtensionValue(String type)
type
- the extension type, case-insensitivepublic int getPort()
public SearchScope getScope()
public int getNbBytes()
public byte[] getBytesReference()
public byte[] getBytesCopy()
public void setScheme(String scheme)
scheme
- the new schemepublic void setPort(int port)
port
- the new portpublic void setAttributes(List<String> attributes)
attributes
- the new attributespublic void setScope(int scope)
SearchScope.OBJECT
,
SearchScope.ONELEVEL
or SearchScope.SUBTREE
,
otherwise SearchScope.OBJECT
is assumed as default.scope
- the new scopepublic void setScope(SearchScope scope)
SearchScope.OBJECT
,
SearchScope.ONELEVEL
or SearchScope.SUBTREE
,
otherwise SearchScope.OBJECT
is assumed as default.scope
- the new scopepublic void setForceScopeRendering(boolean forceScopeRendering)
forceScopeRendering
- the forceScopeRendering to setCopyright © 2003-2014 The Apache Software Foundation. All Rights Reserved.