org.apache.commons.httpclient
Class HttpURL

java.lang.Object
  |
  +--org.apache.commons.httpclient.URI
        |
        +--org.apache.commons.httpclient.HttpURL
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
Direct Known Subclasses:
HttpsURL

public class HttpURL
extends URI

The HTTP URL.

Author:
Sung-Gu
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.apache.commons.httpclient.URI
URI.CharsetChanged, URI.LocaleToCharsetMap
 
Field Summary
static int _default_port
          Default port for HTTP URL.
static char[] _default_scheme
          Default scheme for HTTP URL.
 
Fields inherited from class org.apache.commons.httpclient.URI
_authority, _documentCharset, _fragment, _host, _is_abs_path, _is_hier_part, _is_hostname, _is_IPv4address, _is_IPv6reference, _is_net_path, _is_opaque_part, _is_reg_name, _is_rel_path, _is_server, _opaque, _path, _port, _protocolCharset, _query, _scheme, _uri, _userinfo, abs_path, absoluteURI, allowed_abs_path, allowed_authority, allowed_fragment, allowed_host, allowed_IPv6reference, allowed_opaque_part, allowed_query, allowed_reg_name, allowed_rel_path, allowed_userinfo, allowed_within_authority, allowed_within_path, allowed_within_query, allowed_within_userinfo, alpha, alphanum, authority, control, delims, digit, disallowed_opaque_part, disallowed_rel_path, domainlabel, escaped, fragment, hex, hier_part, host, hostname, hostport, IPv4address, IPv6address, IPv6reference, mark, net_path, opaque_part, param, path, path_segments, pchar, percent, port, query, reg_name, rel_path, rel_segment, relativeURI, reserved, rootPath, scheme, segment, server, space, toplabel, unreserved, unwise, URI_reference, uric, uric_no_slash, userinfo, within_userinfo
 
Constructor Summary
protected HttpURL()
           
  HttpURL(char[] escaped)
          Construct a HTTP URL as an escaped form of a character array.
  HttpURL(HttpURL base, HttpURL relative)
          Construct a HTTP URL with a given relative URL.
  HttpURL(HttpURL base, java.lang.String relative)
          Construct a HTTP URL with a given relative URL string.
  HttpURL(java.lang.String original)
          Construct a HTTP URL from a given string.
  HttpURL(java.lang.String host, int port, java.lang.String path)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String host, int port, java.lang.String path, java.lang.String query)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String host, java.lang.String path)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String userinfo, java.lang.String host, int port, java.lang.String path)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String userinfo, java.lang.String host, int port, java.lang.String path, java.lang.String query)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String userinfo, java.lang.String host, int port, java.lang.String path, java.lang.String query, java.lang.String fragment)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String user, java.lang.String password, java.lang.String host)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String user, java.lang.String password, java.lang.String host, int port)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String user, java.lang.String password, java.lang.String host, int port, java.lang.String path)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String user, java.lang.String password, java.lang.String host, int port, java.lang.String path, java.lang.String query)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String host, java.lang.String path, java.lang.String query, java.lang.String fragment)
          Construct a HTTP URL from given components.
  HttpURL(java.lang.String userinfo, java.lang.String host, java.lang.String path, java.lang.String query, java.lang.String fragment)
          Construct a HTTP URL from given components.
 
Method Summary
protected  void checkValid()
          Verify the valid class use for construction.
 java.lang.String getEscapedPassword()
          Get the escaped password.
 java.lang.String getEscapedUser()
          Get the escaped user
 java.lang.String getPassword()
          Get the password.
 int getPort()
          Get the port number.
 char[] getRawAboveHierPath()
          Get the level above the this hierarchy level.
 char[] getRawCurrentHierPath()
          Get the raw-escaped current hierarchy level.
 char[] getRawPassword()
          Get the raw-escaped password.
 char[] getRawPath()
          Get the raw escaped path.
 char[] getRawScheme()
          Get the scheme.
 char[] getRawUser()
          Get the raw-escaped user.
 java.lang.String getScheme()
          Get the scheme.
 java.lang.String getUser()
          Get the user.
 void setEscapedPassword(java.lang.String escapedPassword)
          Set the escaped password string.
 void setEscapedUser(java.lang.String escapedUser)
          Set the escaped user string.
 void setEscapedUserinfo(java.lang.String escapedUser, java.lang.String escapedPassword)
          Set the raw-escaped user and password.
 void setPassword(java.lang.String password)
          Set the password string.
 void setQuery(java.lang.String[] queryName, java.lang.String[] queryValue)
          Set the query as the name and value pairs.
 void setQuery(java.lang.String queryName, java.lang.String queryValue)
          Set the query as the name and value pair.
 void setRawPassword(char[] escapedPassword)
          Set the raw-escaped password.
 void setRawUser(char[] escapedUser)
          Set the raw-escaped user.
 void setRawUserinfo(char[] escapedUser, char[] escapedPassword)
          Set the raw-escaped user and password.
 void setUser(java.lang.String user)
          Set the user string.
 void setUserinfo(java.lang.String user, java.lang.String password)
          Set the user and password.
 
Methods inherited from class org.apache.commons.httpclient.URI
clone, compareTo, decode, decode, encode, encode, equals, equals, getAboveHierPath, getAuthority, getCurrentHierPath, getDocumentCharset, getEscapedAboveHierPath, getEscapedAuthority, getEscapedCurrentHierPath, getEscapedFragment, getEscapedName, getEscapedPath, getEscapedPathQuery, getEscapedQuery, getEscapedURI, getEscapedURIReference, getEscapedUserinfo, getFragment, getHost, getName, getPath, getPathQuery, getProtocolCharset, getQuery, getRawAuthority, getRawCurrentHierPath, getRawFragment, getRawHost, getRawName, getRawPathQuery, getRawQuery, getRawURI, getRawURIReference, getRawUserinfo, getURI, getURIReference, getUserinfo, hasAuthority, hasFragment, hasQuery, hasUserinfo, indexFirstOf, indexFirstOf, indexFirstOf, indexFirstOf, isAbsoluteURI, isAbsPath, isHierPart, isHostname, isIPv4address, isIPv6reference, isNetPath, isOpaquePart, isRegName, isRelativeURI, isRelPath, isServer, normalize, normalize, parseAuthority, parseUriReference, prevalidate, readObject, removeFragmentIdentifier, resolvePath, setDocumentCharset, setEscapedAuthority, setEscapedFragment, setEscapedPath, setEscapedQuery, setFragment, setPath, setProtocolCharset, setQuery, setRawAuthority, setRawFragment, setRawPath, setRawQuery, setURI, toString, validate, validate, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_default_scheme

public static final char[] _default_scheme
Default scheme for HTTP URL.


_default_port

public static final int _default_port
Default port for HTTP URL.

See Also:
Constant Field Values
Constructor Detail

HttpURL

protected HttpURL()

HttpURL

public HttpURL(char[] escaped)
        throws URIException
Construct a HTTP URL as an escaped form of a character array.

Parameters:
escaped - the HTTP URL character sequence
Throws:
URIException
java.lang.NullPointerException - if escaped is null

HttpURL

public HttpURL(java.lang.String original)
        throws URIException
Construct a HTTP URL from a given string.

Parameters:
original - the HTTP URL string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String host,
               java.lang.String path)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
host - the host string
path - the path string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String host,
               int port,
               java.lang.String path)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
host - the host string
port - the port number
path - the path string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String host,
               int port,
               java.lang.String path,
               java.lang.String query)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
host - the host string
port - the port number
path - the path string
query - the query string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String user,
               java.lang.String password,
               java.lang.String host)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
user - the user name
password - his or her password
host - the host string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String user,
               java.lang.String password,
               java.lang.String host,
               int port)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
user - the user name
password - his or her password
host - the host string
port - the port number
Throws:
URIException

HttpURL

public HttpURL(java.lang.String user,
               java.lang.String password,
               java.lang.String host,
               int port,
               java.lang.String path)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
user - the user name
password - his or her password
host - the host string
port - the port number
path - the path string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String user,
               java.lang.String password,
               java.lang.String host,
               int port,
               java.lang.String path,
               java.lang.String query)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
user - the user name
password - his or her password
host - the host string
port - the port number
path - the path string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String host,
               java.lang.String path,
               java.lang.String query,
               java.lang.String fragment)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
host - the host string
path - the path string
query - the query string
fragment - the fragment string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String userinfo,
               java.lang.String host,
               java.lang.String path,
               java.lang.String query,
               java.lang.String fragment)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
userinfo - the userinfo string
host - the host string
path - the path string
query - the query string
fragment - the fragment string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String userinfo,
               java.lang.String host,
               int port,
               java.lang.String path)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
userinfo - the userinfo string
host - the host string
port - the port number
path - the path string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String userinfo,
               java.lang.String host,
               int port,
               java.lang.String path,
               java.lang.String query)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
userinfo - the userinfo string
host - the host string
port - the port number
path - the path string
query - the query string
Throws:
URIException

HttpURL

public HttpURL(java.lang.String userinfo,
               java.lang.String host,
               int port,
               java.lang.String path,
               java.lang.String query,
               java.lang.String fragment)
        throws URIException
Construct a HTTP URL from given components.

Parameters:
userinfo - the userinfo string
host - the host string
port - the port number
path - the path string
query - the query string
fragment - the fragment string
Throws:
URIException

HttpURL

public HttpURL(HttpURL base,
               java.lang.String relative)
        throws URIException
Construct a HTTP URL with a given relative URL string.

Parameters:
base - the base HttpURL
relative - the relative HTTP URL string
Throws:
URIException

HttpURL

public HttpURL(HttpURL base,
               HttpURL relative)
        throws URIException
Construct a HTTP URL with a given relative URL.

Parameters:
base - the base HttpURL
relative - the relative HttpURL
Throws:
URIException
Method Detail

getRawScheme

public char[] getRawScheme()
Get the scheme. You can get the scheme explicitly.

Overrides:
getRawScheme in class URI
Returns:
the scheme

getScheme

public java.lang.String getScheme()
Get the scheme. You can get the scheme explicitly.

Overrides:
getScheme in class URI
Returns:
the scheme null if empty or undefined

getPort

public int getPort()
Get the port number.

Overrides:
getPort in class URI
Returns:
the port if -1, it has the default port for the scheme or the server-based naming authority is not supported in the specific URI.

setRawUserinfo

public void setRawUserinfo(char[] escapedUser,
                           char[] escapedPassword)
                    throws URIException
Set the raw-escaped user and password.

Parameters:
escapedUser - the raw-escaped user
escapedPassword - the raw-escaped password; could be null
Throws:
URIException - escaped user not valid or user required; escaped password not valid or username missed

setEscapedUserinfo

public void setEscapedUserinfo(java.lang.String escapedUser,
                               java.lang.String escapedPassword)
                        throws URIException
Set the raw-escaped user and password.

Parameters:
escapedUser - the escaped user
escapedPassword - the escaped password; could be null
Throws:
URIException - escaped user not valid or user required; escaped password not valid or username missed
java.lang.NullPointerException - null user

setUserinfo

public void setUserinfo(java.lang.String user,
                        java.lang.String password)
                 throws URIException
Set the user and password.

Parameters:
user - the user
password - the password; could be null
Throws:
URIException - encoding error or username missed
java.lang.NullPointerException - null user

setRawUser

public void setRawUser(char[] escapedUser)
                throws URIException
Set the raw-escaped user.

Throws:
URIException - escaped user not valid or user required

setEscapedUser

public void setEscapedUser(java.lang.String escapedUser)
                    throws URIException
Set the escaped user string.

Parameters:
escapedUser - the escaped user string
Throws:
URIException - escaped user not valid
java.lang.NullPointerException - null user

setUser

public void setUser(java.lang.String user)
             throws URIException
Set the user string.

Parameters:
user - the user string
Throws:
URIException - user encoding error
java.lang.NullPointerException - null user

getRawUser

public char[] getRawUser()
Get the raw-escaped user.

Returns:
the raw-escaped user

getEscapedUser

public java.lang.String getEscapedUser()
Get the escaped user

Returns:
the escaped user

getUser

public java.lang.String getUser()
                         throws URIException
Get the user.

Returns:
the user name
Throws:
URIException

setRawPassword

public void setRawPassword(char[] escapedPassword)
                    throws URIException
Set the raw-escaped password.

Throws:
URIException - escaped password not valid or username missed

setEscapedPassword

public void setEscapedPassword(java.lang.String escapedPassword)
                        throws URIException
Set the escaped password string.

Throws:
URIException - escaped password not valid or username missed

setPassword

public void setPassword(java.lang.String password)
                 throws URIException
Set the password string.

Parameters:
password - the password string; could be null
Throws:
URIException - encoding error or username missed

getRawPassword

public char[] getRawPassword()
Get the raw-escaped password.

Returns:
the raw-escaped password

getEscapedPassword

public java.lang.String getEscapedPassword()
Get the escaped password.

Returns:
the escaped password

getPassword

public java.lang.String getPassword()
                             throws URIException
Get the password.

Returns:
the password
Throws:
URIException

getRawCurrentHierPath

public char[] getRawCurrentHierPath()
                             throws URIException
Get the raw-escaped current hierarchy level.

Overrides:
getRawCurrentHierPath in class URI
Returns:
the raw-escaped current hierarchy level
Throws:
URIException - no hierarchy level

getRawAboveHierPath

public char[] getRawAboveHierPath()
                           throws URIException
Get the level above the this hierarchy level.

Overrides:
getRawAboveHierPath in class URI
Returns:
the raw above hierarchy level
Throws:
URIException

getRawPath

public char[] getRawPath()
Get the raw escaped path.

Overrides:
getRawPath in class URI
Returns:
the path '/' if empty or undefined

setQuery

public void setQuery(java.lang.String queryName,
                     java.lang.String queryValue)
              throws URIException
Set the query as the name and value pair.

Parameters:
queryName - the query string.
queryValue - the query string.
Throws:
URIException - incomplete trailing escape pattern Or unsupported character encoding
java.lang.NullPointerException - null query
See Also:
URI.encode(java.lang.String, java.util.BitSet)

setQuery

public void setQuery(java.lang.String[] queryName,
                     java.lang.String[] queryValue)
              throws URIException
Set the query as the name and value pairs.

Parameters:
queryName - the array of the query string.
queryValue - the array of the query string.
Throws:
URIException - incomplete trailing escape pattern, unsupported character encoding or wrong array size
java.lang.NullPointerException - null query
See Also:
URI.encode(java.lang.String, java.util.BitSet)

checkValid

protected void checkValid()
                   throws URIException
Verify the valid class use for construction.

Throws:
URIException - the wrong scheme use


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.