Class HttpURL
java.lang.Object
org.apache.commons.httpclient.URI
org.apache.commons.httpclient.HttpURL
- All Implemented Interfaces:
Serializable, Cloneable, Comparable
- Direct Known Subclasses:
HttpsURL
-
Nested Class Summary
Nested classes/interfaces inherited from class URI
URI.DefaultCharsetChanged, URI.LocaleToCharsetMap -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final char[]Deprecated.UseDEFAULT_SCHEMEinstead.static final intDefault port for HTTP URL.static final char[]Default scheme for HTTP URL.Fields inherited from class URI
_authority, _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, _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, defaultDocumentCharset, defaultDocumentCharsetByLocale, defaultDocumentCharsetByPlatform, defaultProtocolCharset, delims, digit, disallowed_opaque_part, disallowed_rel_path, domainlabel, escaped, fragment, hash, hex, hier_part, host, hostname, hostport, IPv4address, IPv6address, IPv6reference, mark, net_path, opaque_part, param, path, path_segments, pchar, percent, port, protocolCharset, 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
ConstructorsModifierConstructorDescriptionprotectedHttpURL()Create an instance as an internal use.HttpURL(char[] escaped) Construct a HTTP URL as an escaped form of a character array.Construct a HTTP URL as an escaped form of a character array with the given charset to do escape encoding.Construct a HTTP URL from a given string.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from a given string with the given charset to do escape encoding.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from given components.HttpURL(String user, String password, String host, int port, String path, String query, String fragment) Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL from given components.Construct a HTTP URL with a given relative URL string.Construct a HTTP URL with a given relative URL. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidVerify the valid class use for construction.Get the escaped password.Get the escaped userGet the password.intgetPort()Get the port number.char[]Get the level above the this hierarchy level.char[]Get the raw-escaped current hierarchy level.char[]Get the raw-escaped password.char[]Get the raw escaped path.char[]Get the scheme.char[]Get the raw-escaped user.Get the scheme.getUser()Get the user.voidsetEscapedPassword(String escapedPassword) Set the escaped password string.voidsetEscapedUser(String escapedUser) Set the escaped user string.voidsetEscapedUserinfo(String escapedUser, String escapedPassword) Set the raw-escaped user and password.voidsetPassword(String password) Set the password string.voidSet the query as the name and value pairs.voidSet the query as the name and value pair.voidsetRawPassword(char[] escapedPassword) Set the raw-escaped password.voidsetRawUser(char[] escapedUser) Set the raw-escaped user.voidsetRawUserinfo(char[] escapedUser, char[] escapedPassword) Set the raw-escaped user and password.protected voidsetURI()Once it's parsed successfully, set this URI.voidSet the user string.voidsetUserinfo(String user, String password) Set the user and password.protected static StringtoUserinfo(String user, String password) Methods inherited from class URI
clone, compareTo, decode, decode, encode, equals, equals, getAboveHierPath, getAuthority, getCurrentHierPath, getDefaultDocumentCharset, getDefaultDocumentCharsetByLocale, getDefaultDocumentCharsetByPlatform, getDefaultProtocolCharset, 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, hashCode, hasQuery, hasUserinfo, indexFirstOf, indexFirstOf, indexFirstOf, indexFirstOf, isAbsoluteURI, isAbsPath, isHierPart, isHostname, isIPv4address, isIPv6reference, isNetPath, isOpaquePart, isRegName, isRelativeURI, isRelPath, isServer, normalize, normalize, parseAuthority, parseUriReference, prevalidate, removeFragmentIdentifier, resolvePath, setDefaultDocumentCharset, setDefaultProtocolCharset, setEscapedAuthority, setEscapedFragment, setEscapedPath, setEscapedQuery, setFragment, setPath, setQuery, setRawAuthority, setRawFragment, setRawPath, setRawQuery, toString, validate, validate
-
Field Details
-
DEFAULT_SCHEME
public static final char[] DEFAULT_SCHEMEDefault scheme for HTTP URL. -
_default_scheme
public static final char[] _default_schemeDeprecated.UseDEFAULT_SCHEMEinstead. This one doesn't conform to the project naming conventions.Default scheme for HTTP URL. -
DEFAULT_PORT
public static final int DEFAULT_PORTDefault port for HTTP URL.- See Also:
-
_default_port
public static final int _default_portDeprecated.UseDEFAULT_PORTinstead. This one doesn't conform to the project naming conventions.Default port for HTTP URL.- See Also:
-
-
Constructor Details
-
HttpURL
protected HttpURL()Create an instance as an internal use. -
HttpURL
Construct a HTTP URL as an escaped form of a character array with the given charset to do escape encoding.- Parameters:
escaped- the HTTP URL character sequencecharset- the charset string to do escape encoding- Throws:
URIException- IfcheckValid()failsNullPointerException- ifescapedisnull- See Also:
-
HttpURL
Construct a HTTP URL as an escaped form of a character array.- Parameters:
escaped- the HTTP URL character sequence- Throws:
URIException- IfcheckValid()failsNullPointerException- ifescapedisnull- See Also:
-
HttpURL
Construct a HTTP URL from a given string with the given charset to do escape encoding.- Parameters:
original- the HTTP URL stringcharset- the charset string to do escape encoding- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from a given string.- Parameters:
original- the HTTP URL string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from given components.- Parameters:
host- the host stringport- the port numberpath- the path string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from given components.- Parameters:
host- the host stringport- the port numberpath- the path stringquery- the query string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from given components.- Parameters:
user- the user namepassword- his or her passwordhost- the host string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from given components.- Parameters:
user- the user namepassword- his or her passwordhost- the host stringport- the port number- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
public HttpURL(String user, String password, String host, int port, String path) throws URIException Construct a HTTP URL from given components.- Parameters:
user- the user namepassword- his or her passwordhost- the host stringport- the port numberpath- the path string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
public HttpURL(String user, String password, String host, int port, String path, String query) throws URIException Construct a HTTP URL from given components.- Parameters:
user- the user namepassword- his or her passwordhost- the host stringport- the port numberpath- the path stringquery- The query string.- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from given components.- Parameters:
host- the host stringpath- the path stringquery- the query stringfragment- the fragment string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
public HttpURL(String userinfo, String host, String path, String query, String fragment) throws URIException Construct a HTTP URL from given components. Note: Theuserinfoformat is normally<username>:<password>where username and password must both be URL escaped.- Parameters:
userinfo- the userinfo string whose parts are URL escapedhost- the host stringpath- the path stringquery- the query stringfragment- the fragment string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL from given components. Note: Theuserinfoformat is normally<username>:<password>where username and password must both be URL escaped.- Parameters:
userinfo- the userinfo string whose parts are URL escapedhost- the host stringport- the port numberpath- the path string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
public HttpURL(String userinfo, String host, int port, String path, String query) throws URIException Construct a HTTP URL from given components. Note: Theuserinfoformat is normally<username>:<password>where username and password must both be URL escaped.- Parameters:
userinfo- the userinfo string whose parts are URL escapedhost- the host stringport- the port numberpath- the path stringquery- the query string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
public HttpURL(String userinfo, String host, int port, String path, String query, String fragment) throws URIException Construct a HTTP URL from given components. Note: Theuserinfoformat is normally<username>:<password>where username and password must both be URL escaped.- Parameters:
userinfo- the userinfo string whose parts are URL escapedhost- the host stringport- the port numberpath- the path stringquery- the query stringfragment- the fragment string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
public HttpURL(String user, String password, String host, int port, String path, String query, String fragment) throws URIException Construct a HTTP URL from given components.- Parameters:
user- the user namepassword- his or her passwordhost- the host stringport- the port numberpath- the path stringquery- the query stringfragment- the fragment string- Throws:
URIException- IfcheckValid()fails- See Also:
-
HttpURL
Construct a HTTP URL with a given relative URL string.- Parameters:
base- the base HttpURLrelative- the relative HTTP URL string- Throws:
URIException- IfcheckValid()fails
-
HttpURL
Construct a HTTP URL with a given relative URL.- Parameters:
base- the base HttpURLrelative- the relative HttpURL- Throws:
URIException- IfcheckValid()fails
-
-
Method Details
-
toUserinfo
- Throws:
URIException
-
getRawScheme
public char[] getRawScheme()Get the scheme. You can get the scheme explicitly.- Overrides:
getRawSchemein classURI- Returns:
- the scheme
-
getScheme
-
getPort
-
setRawUserinfo
Set the raw-escaped user and password.- Parameters:
escapedUser- the raw-escaped userescapedPassword- 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(String escapedUser, String escapedPassword) throws URIException, NullPointerException Set the raw-escaped user and password.- Parameters:
escapedUser- the escaped userescapedPassword- the escaped password; could be null- Throws:
URIException- escaped user not valid or user required; escaped password not valid or username missedNullPointerException- null user
-
setUserinfo
Set the user and password.- Parameters:
user- the userpassword- the password; could be null- Throws:
URIException- encoding error or username missedNullPointerException- null user
-
setRawUser
Set the raw-escaped user.- Parameters:
escapedUser- the raw-escaped user- Throws:
URIException- escaped user not valid or user required
-
setEscapedUser
Set the escaped user string.- Parameters:
escapedUser- the escaped user string- Throws:
URIException- escaped user not validNullPointerException- null user
-
setUser
Set the user string.- Parameters:
user- the user string- Throws:
URIException- user encoding errorNullPointerException- null user
-
getRawUser
public char[] getRawUser()Get the raw-escaped user.- Returns:
- the raw-escaped user
-
getEscapedUser
-
getUser
Get the user.- Returns:
- the user name
- Throws:
URIException- IfURI.decode(char[], String)fails
-
setRawPassword
Set the raw-escaped password.- Parameters:
escapedPassword- the raw-escaped password; could be null- Throws:
URIException- escaped password not valid or username missed
-
setEscapedPassword
Set the escaped password string.- Parameters:
escapedPassword- the escaped password string; could be null- Throws:
URIException- escaped password not valid or username missed
-
setPassword
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
-
getPassword
Get the password.- Returns:
- the password
- Throws:
URIException- IfURI.decode(char[],String)fails.
-
getRawCurrentHierPath
Get the raw-escaped current hierarchy level.- Overrides:
getRawCurrentHierPathin classURI- Returns:
- the raw-escaped current hierarchy level
- Throws:
URIException- IfURI.getRawCurrentHierPath(char[])fails.
-
getRawAboveHierPath
Get the level above the this hierarchy level.- Overrides:
getRawAboveHierPathin classURI- Returns:
- the raw above hierarchy level
- Throws:
URIException- IfURI.getRawCurrentHierPath(char[])fails.
-
getRawPath
public char[] getRawPath()Get the raw escaped path.- Overrides:
getRawPathin classURI- Returns:
- the path '/' if empty or undefined
-
setQuery
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 encodingNullPointerException- null query- See Also:
-
setQuery
public void setQuery(String[] queryName, String[] queryValue) throws URIException, NullPointerException 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 sizeNullPointerException- null query- See Also:
-
checkValid
Verify the valid class use for construction.- Throws:
URIException- the wrong scheme use
-
setURI
-
DEFAULT_PORTinstead.