org.apache.directory.shared.ldap.codec.util
Class LdapURL

java.lang.Object
  extended byorg.apache.directory.shared.ldap.codec.util.LdapString
      extended byorg.apache.directory.shared.ldap.codec.util.LdapURL

public class LdapURL
extends LdapString

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 = LdapDN 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

Author:
Apache Directory Project

Field Summary
static LdapURL EMPTY_URL
          A null LdapURL
 
Fields inherited from class org.apache.directory.shared.ldap.codec.util.LdapString
bytes, EMPTY_BYTES, EMPTY_STRING, string
 
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
static byte[] getAsciiBytes(java.lang.String data)
          Converts the specified string to byte array of ASCII characters.
 java.util.ArrayList getAttributes()
           
 java.util.HashMap getCriticalExtensions()
           
 LdapDN getDn()
           
 java.util.HashMap getExtensions()
           
 java.lang.String getFilter()
           
 java.lang.String getHost()
           
 int getPort()
           
 java.lang.String getScheme()
           
 int getScope()
           
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.
 void parse(char[] chars)
           
 java.lang.String toString()
          Get a string representation of a LdapURL.
 
Methods inherited from class org.apache.directory.shared.ldap.codec.util.LdapString
getBytes, getNbBytes, getString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_URL

public static final transient LdapURL EMPTY_URL
A null LdapURL

Constructor Detail

LdapURL

public LdapURL()
Construct an empty LdapURL


LdapURL

public LdapURL(java.lang.String string)
        throws LdapURLEncodingException
Create a new LdapURL from a String after having parsed it.

Parameters:
string - TheString that contains the LDAPURL
Throws:
org.apache.directory.shared.asn1.codec.DecoderException - If the String does not comply with RFC 2255
LdapURLEncodingException

LdapURL

public LdapURL(byte[] bytes)
        throws LdapURLEncodingException
Create a new LdapURL after having parsed it.

Parameters:
bytes - The byte buffer that contains the LDAPURL
Throws:
org.apache.directory.shared.asn1.codec.DecoderException - If the byte array does not comply with RFC 2255
LdapURLEncodingException
Method Detail

parse

public void parse(char[] chars)
           throws LdapURLEncodingException
Throws:
LdapURLEncodingException

getString

public static java.lang.String getString(byte[] data,
                                         int offset,
                                         int length,
                                         java.lang.String charset)
From commons-httpclients. Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.

Parameters:
data - the byte array to be encoded
offset - the index of the first byte to encode
length - the number of bytes to encode
charset - the desired character encoding
Returns:
The result of the conversion.
Since:
3.0

getString

public static java.lang.String getString(byte[] data,
                                         java.lang.String charset)
From commons-httpclients. Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.

Parameters:
data - the byte array to be encoded
charset - the desired character encoding
Returns:
The result of the conversion.
Since:
3.0

getAsciiBytes

public static byte[] getAsciiBytes(java.lang.String data)
Converts the specified string to byte array of ASCII characters.

Parameters:
data - the string to be encoded
Returns:
The string as a byte array.
Since:
3.0

toString

public java.lang.String toString()
Get a string representation of a LdapURL.

Overrides:
toString in class LdapString
Returns:
A LdapURL string

getAttributes

public java.util.ArrayList getAttributes()
Returns:
Returns the attributes.

getCriticalExtensions

public java.util.HashMap getCriticalExtensions()
Returns:
Returns the criticalExtensions.

getDn

public LdapDN getDn()
Returns:
Returns the dn.

getExtensions

public java.util.HashMap getExtensions()
Returns:
Returns the extensions.

getFilter

public java.lang.String getFilter()
Returns:
Returns the filter.

getHost

public java.lang.String getHost()
Returns:
Returns the host.

getPort

public int getPort()
Returns:
Returns the port.

getScope

public int getScope()
Returns:
Returns the scope.

getScheme

public java.lang.String getScheme()
Returns:
Returns the scheme.


Copyright © 2003-2006 . All Rights Reserved.