|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.httpclient.URI org.archive.net.LaxURI org.archive.net.UURI
public class UURI
Usable URI.
This class wraps URI
adding caching
and methods. It cannot be instantiated directly. Go via UURIFactory.
We used to use URI
for parsing URIs but ran across
quirky behaviors and bugs. URI
is not subclassable --
its final -- and its unlikely that java.net.URI will change any time soon
(See Gordon's considered petition here:
java.net.URI
should have loose/tolerant/compatibility option (or allow reuse)).
This class tries to cache calculated strings such as the extracted host and this class as a string rather than have the parent class rerun its calculation everytime.
URI
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.commons.httpclient.URI |
---|
org.apache.commons.httpclient.URI.DefaultCharsetChanged, org.apache.commons.httpclient.URI.LocaleToCharsetMap |
Field Summary | |
---|---|
static java.lang.String |
MASSAGEHOST_PATTERN
|
static int |
MAX_URL_LENGTH
Consider URIs too long for IE as illegal. |
Fields inherited from class org.archive.net.LaxURI |
---|
HTTP_SCHEME, HTTPS_SCHEME, lax_abs_path, lax_query, lax_rel_segment |
Fields inherited from class org.apache.commons.httpclient.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 | |
---|---|
protected |
UURI()
Shutdown access to default constructor. |
protected |
UURI(java.lang.String uri,
boolean escaped)
|
protected |
UURI(java.lang.String uri,
boolean escaped,
java.lang.String charset)
|
protected |
UURI(UURI base,
UURI relative)
|
Method Summary | |
---|---|
char |
charAt(int index)
|
protected void |
coalesceHostAuthorityStrings()
The two String fields cachedHost and cachedAuthorityMinusUserInfo are usually identical; if so, coalesce into a single instance. |
protected void |
coalesceUriStrings()
The two String fields cachedString and cachedEscapedURI are usually identical; if so, coalesce into a single instance. |
int |
compareTo(java.lang.Object arg0)
|
boolean |
equals(java.lang.Object obj)
Test an object if this UURI is equal to another. |
static UURI |
from(java.lang.Object o)
Convenience method for finding the UURI inside an Object likely to have (or be/imply) one. |
java.lang.String |
getAuthorityMinusUserinfo()
Return the authority minus userinfo (if any). |
java.lang.String |
getEscapedURI()
|
java.lang.String |
getHost()
|
java.lang.String |
getHostBasename()
Strips www variants from the host. |
java.lang.String |
getReferencedHost()
Return the referenced host in the UURI, if any, also extracting the host of a DNS-lookup URI where necessary. |
java.lang.String |
getSurtForm()
|
static boolean |
hasScheme(java.lang.String possibleUrl)
Test if passed String has likely URI scheme prefix. |
int |
length()
|
static java.lang.String |
parseFilename(java.lang.String pathOrUri)
|
UURI |
resolve(java.lang.String uri)
|
UURI |
resolve(java.lang.String uri,
boolean e)
|
UURI |
resolve(java.lang.String uri,
boolean e,
java.lang.String charset)
|
java.lang.CharSequence |
subSequence(int start,
int end)
|
java.lang.String |
toString()
Override to cache result |
Methods inherited from class org.archive.net.LaxURI |
---|
decode, decode, getPath, getPathQuery, getURI, lax, parseAuthority, parseUriReference, setURI, validate, validate |
Methods inherited from class org.apache.commons.httpclient.URI |
---|
clone, encode, equals, getAboveHierPath, getAuthority, getCurrentHierPath, getDefaultDocumentCharset, getDefaultDocumentCharsetByLocale, getDefaultDocumentCharsetByPlatform, getDefaultProtocolCharset, getEscapedAboveHierPath, getEscapedAuthority, getEscapedCurrentHierPath, getEscapedFragment, getEscapedName, getEscapedPath, getEscapedPathQuery, getEscapedQuery, getEscapedURIReference, getEscapedUserinfo, getFragment, getName, getPort, getProtocolCharset, getQuery, getRawAboveHierPath, getRawAuthority, getRawCurrentHierPath, getRawCurrentHierPath, getRawFragment, getRawHost, getRawName, getRawPath, getRawPathQuery, getRawQuery, getRawScheme, getRawURI, getRawURIReference, getRawUserinfo, getScheme, 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, prevalidate, removeFragmentIdentifier, resolvePath, setDefaultDocumentCharset, setDefaultProtocolCharset, setEscapedAuthority, setEscapedFragment, setEscapedPath, setEscapedQuery, setFragment, setPath, setQuery, setRawAuthority, setRawFragment, setRawPath, setRawQuery |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_URL_LENGTH
public static final java.lang.String MASSAGEHOST_PATTERN
Constructor Detail |
---|
protected UURI()
protected UURI(java.lang.String uri, boolean escaped, java.lang.String charset) throws org.apache.commons.httpclient.URIException
uri
- String representation of an absolute URI.escaped
- If escaped.charset
- Charset to use.
org.apache.commons.httpclient.URIException
protected UURI(UURI base, UURI relative) throws org.apache.commons.httpclient.URIException
relative
- String representation of URI.base
- Parent UURI to use derelativizing.
org.apache.commons.httpclient.URIException
protected UURI(java.lang.String uri, boolean escaped) throws org.apache.commons.httpclient.URIException, java.lang.NullPointerException
uri
- String representation of a URI.escaped
- If escaped.
java.lang.NullPointerException
org.apache.commons.httpclient.URIException
Method Detail |
---|
public UURI resolve(java.lang.String uri) throws org.apache.commons.httpclient.URIException
uri
- URI as string that is resolved relative to this UURI.
org.apache.commons.httpclient.URIException
public UURI resolve(java.lang.String uri, boolean e) throws org.apache.commons.httpclient.URIException
uri
- URI as string that is resolved relative to this UURI.e
- True if escaped.
org.apache.commons.httpclient.URIException
public UURI resolve(java.lang.String uri, boolean e, java.lang.String charset) throws org.apache.commons.httpclient.URIException
uri
- URI as string that is resolved relative to this UURI.e
- True if uri is escaped.charset
- Charset to use.
org.apache.commons.httpclient.URIException
public boolean equals(java.lang.Object obj)
equals
in class org.apache.commons.httpclient.URI
obj
- an object to compare
public java.lang.String getHostBasename() throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIException
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class org.apache.commons.httpclient.URI
public java.lang.String getEscapedURI()
getEscapedURI
in class org.apache.commons.httpclient.URI
protected void coalesceUriStrings()
public java.lang.String getHost() throws org.apache.commons.httpclient.URIException
getHost
in class org.apache.commons.httpclient.URI
org.apache.commons.httpclient.URIException
protected void coalesceHostAuthorityStrings()
public java.lang.String getReferencedHost() throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIException
public java.lang.String getSurtForm()
public java.lang.String getAuthorityMinusUserinfo() throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIException
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public int compareTo(java.lang.Object arg0)
compareTo
in interface java.lang.Comparable
compareTo
in class org.apache.commons.httpclient.URI
public static UURI from(java.lang.Object o)
o
- Object that is, has, or implies a UURI
public static boolean hasScheme(java.lang.String possibleUrl)
possibleUrl
- URL string to examine.
public static java.lang.String parseFilename(java.lang.String pathOrUri) throws java.net.URISyntaxException
pathOrUri
- A file path or a URI.
pathOrUri
.
java.net.URISyntaxException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |