public class LdapURL extends Object
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(byte[] bytes)
Create a new LdapURL after having parsed it.
|
LdapURL(String string)
Create a new LdapURL from a String after having parsed it.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static byte[] |
getAsciiBytes(String data)
Converts the specified string to byte array of ASCII characters.
|
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()
Returns the scope, one of
SearchScope.OBJECT ,
SearchScope.ONELEVEL or SearchScope.SUBTREE . |
String |
getString() |
static String |
getString(byte[] data,
int offset,
int length,
String charset)
From commons-httpclients.
|
static String |
getString(byte[] data,
String charset)
From commons-httpclients.
|
int |
hashCode()
Compute the instance's hash code
|
boolean |
isForceScopeRendering()
If set to true forces the toString method to render the scope
regardless of optional nature.
|
void |
parse(char[] chars)
Parse a LdapURL
|
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 static final LdapURL EMPTY_URL
public LdapURL()
public LdapURL(String string) throws LdapURLEncodingException
string
- TheString that contains the LDAPURLLdapURLEncodingException
- If the String does not comply with RFC 2255public LdapURL(byte[] bytes) throws LdapURLEncodingException
bytes
- The byte buffer that contains the LDAPURLLdapURLEncodingException
- If the byte array does not comply with RFC 2255public void parse(char[] chars) throws LdapURLEncodingException
chars
- The chars containing the URLLdapURLEncodingException
- If the URL is invalidpublic static String getString(byte[] data, int offset, int length, String charset)
data
- the byte array to be encodedoffset
- the index of the first byte to encodelength
- the number of bytes to encodecharset
- the desired character encodingpublic static String getString(byte[] data, String charset)
data
- the byte array to be encodedcharset
- the desired character encodingpublic static byte[] getAsciiBytes(String data)
data
- the string to be encodedpublic 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 DN getDn()
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 String getFilter()
public String getHost()
public int getPort()
public SearchScope getScope()
SearchScope.OBJECT
,
SearchScope.ONELEVEL
or SearchScope.SUBTREE
.public String getScheme()
public int getNbBytes()
public byte[] getBytesReference()
public byte[] getBytesCopy()
public String getString()
public int hashCode()
public void setScheme(String scheme)
scheme
- the new schemepublic void setHost(String host)
host
- the new hostpublic void setPort(int port)
port
- the new portpublic void setDn(DN dn)
dn
- the new dnpublic 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 setFilter(String filter)
filter
- the new filterpublic void setForceScopeRendering(boolean forceScopeRendering)
forceScopeRendering
- the forceScopeRendering to setpublic boolean isForceScopeRendering()
Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.