|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.shared.ldap.util.LdapURL
public class LdapURL
Decodes a LdapUrl, and checks that it complies with the RFC 2255. The grammar is the following : 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
Nested Class Summary | |
---|---|
static class |
LdapURL.Extension
An inner bean to hold extension information. |
Field Summary | |
---|---|
static LdapURL |
EMPTY_URL
A null LdapURL |
static java.lang.String |
LDAP_SCHEME
The constant for "ldap://" scheme. |
static java.lang.String |
LDAPS_SCHEME
The constant for "ldaps://" scheme. |
Constructor Summary | |
---|---|
LdapURL()
Construct an empty LdapURL |
|
LdapURL(byte[] bytes)
Create a new LdapURL after having parsed it. |
|
LdapURL(java.lang.String string)
Create a new LdapURL from a String after having parsed it. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
static byte[] |
getAsciiBytes(java.lang.String data)
Converts the specified string to byte array of ASCII characters. |
java.util.List<java.lang.String> |
getAttributes()
|
byte[] |
getBytesCopy()
|
byte[] |
getBytesReference()
|
DN |
getDn()
|
LdapURL.Extension |
getExtension(java.lang.String type)
Gets the extension. |
java.util.List<LdapURL.Extension> |
getExtensions()
|
java.lang.String |
getExtensionValue(java.lang.String type)
Gets the extension value. |
java.lang.String |
getFilter()
|
java.lang.String |
getHost()
|
int |
getNbBytes()
|
int |
getPort()
|
java.lang.String |
getScheme()
|
SearchScope |
getScope()
Returns the scope, one of SearchScope.OBJECT ,
SearchScope.ONELEVEL or SearchScope.SUBTREE . |
java.lang.String |
getString()
|
static java.lang.String |
getString(byte[] data,
int offset,
int length,
java.lang.String charset)
From commons-httpclients. |
static java.lang.String |
getString(byte[] data,
java.lang.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(java.util.List<java.lang.String> attributes)
Sets the attributes, null removes all existing attributes. |
void |
setDn(DN dn)
Sets the dn. |
void |
setFilter(java.lang.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(java.lang.String host)
Sets the host. |
void |
setPort(int port)
Sets the port. |
void |
setScheme(java.lang.String scheme)
Sets the scheme. |
void |
setScope(int scope)
Sets the scope. |
void |
setScope(SearchScope scope)
Sets the scope. |
java.lang.String |
toString()
Get a string representation of a LdapURL. |
static java.lang.String |
urlEncode(java.lang.String url,
boolean doubleEncode)
Encode a String to avoid special characters. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LDAPS_SCHEME
public static final java.lang.String LDAP_SCHEME
public static final LdapURL EMPTY_URL
Constructor Detail |
---|
public LdapURL()
public LdapURL(java.lang.String string) throws LdapURLEncodingException
string
- TheString that contains the LDAPURL
LdapURLEncodingException
- If the String does not comply with RFC 2255public LdapURL(byte[] bytes) throws LdapURLEncodingException
bytes
- The byte buffer that contains the LDAPURL
LdapURLEncodingException
- If the byte array does not comply with RFC 2255Method Detail |
---|
public void parse(char[] chars) throws LdapURLEncodingException
chars
- The chars containing the URL
LdapURLEncodingException
- If the URL is invalidpublic static java.lang.String getString(byte[] data, int offset, int length, java.lang.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 encoding
public static java.lang.String getString(byte[] data, java.lang.String charset)
data
- the byte array to be encodedcharset
- the desired character encoding
public static byte[] getAsciiBytes(java.lang.String data)
data
- the string to be encoded
public static java.lang.String urlEncode(java.lang.String url, boolean doubleEncode)
url
- The String to encodedoubleEncode
- Set if we need to encode the comma
public java.lang.String toString()
toString
in class java.lang.Object
forceScopeRendering
public java.util.List<java.lang.String> getAttributes()
public DN getDn()
public java.util.List<LdapURL.Extension> getExtensions()
public LdapURL.Extension getExtension(java.lang.String type)
type
- the extension type, case-insensitive
public java.lang.String getExtensionValue(java.lang.String type)
type
- the extension type, case-insensitive
public java.lang.String getFilter()
public java.lang.String getHost()
public int getPort()
public SearchScope getScope()
SearchScope.OBJECT
,
SearchScope.ONELEVEL
or SearchScope.SUBTREE
.
public java.lang.String getScheme()
public int getNbBytes()
public byte[] getBytesReference()
public byte[] getBytesCopy()
public java.lang.String getString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void setScheme(java.lang.String scheme)
scheme
- the new schemepublic void setHost(java.lang.String host)
host
- the new hostpublic void setPort(int port)
port
- the new portpublic void setDn(DN dn)
dn
- the new dnpublic void setAttributes(java.util.List<java.lang.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(java.lang.String filter)
filter
- the new filterpublic void setForceScopeRendering(boolean forceScopeRendering)
forceScopeRendering
- the forceScopeRendering to setpublic boolean isForceScopeRendering()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |