| java.lang.Object java.net.URI org.archive.net.LaxURI org.archive.net.UURI
UURI | public class UURI extends LaxURI implements CharSequence,Serializable(Code) | | Usable URI.
This class wraps
org.apache.commons.httpclient.URI adding caching
and methods. It cannot be instantiated directly. Go via UURIFactory.
We used to use
java.net.URI for parsing URIs but ran across
quirky behaviors and bugs.
java.net.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.
author: gojomo author: stack See Also: org.apache.commons.httpclient.URI |
Constructor Summary | |
protected | UURI() Shutdown access to default constructor. | protected | UURI(String uri, boolean escaped, String charset) | protected | UURI(UURI base, UURI relative) | public | UURI(String uri, boolean escaped) |
Method Summary | |
public 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. | public int | compareTo(Object arg0) | public boolean | equals(Object obj) Test an object if this UURI is equal to another. | public static UURI | from(Object o) Convenience method for finding the UURI inside an
Object likely to have (or be/imply) one. | public String | getAuthorityMinusUserinfo() Return the authority minus userinfo (if any). | public synchronized String | getEscapedURI() | public synchronized String | getHost() | public String | getHostBasename() Strips www variants from the host.
Strips www[0-9]*\. | public String | getReferencedHost() Return the referenced host in the UURI, if any, also extracting the
host of a DNS-lookup URI where necessary. | public String | getSurtForm() | public static boolean | hasScheme(String possibleUrl) Test if passed String has likely URI scheme prefix.
Parameters: possibleUrl - URL string to examine. | public int | length() | public static String | parseFilename(String pathOrUri) Parameters: pathOrUri - A file path or a URI. | public UURI | resolve(String uri) Parameters: uri - URI as string that is resolved relative to this UURI. | public UURI | resolve(String uri, boolean e) Parameters: uri - URI as string that is resolved relative to this UURI. Parameters: e - True if escaped. | public UURI | resolve(String uri, boolean e, String charset) Parameters: uri - URI as string that is resolved relative to this UURI. Parameters: e - True if uri is escaped. Parameters: charset - Charset to use. | public CharSequence | subSequence(int start, int end) | public synchronized String | toString() |
MASSAGEHOST_PATTERN | final public static String MASSAGEHOST_PATTERN(Code) | | |
MAX_URL_LENGTH | final public static int MAX_URL_LENGTH(Code) | | Consider URIs too long for IE as illegal.
|
UURI | protected UURI()(Code) | | Shutdown access to default constructor.
|
UURI | protected UURI(String uri, boolean escaped, String charset) throws URIException(Code) | | Parameters: uri - String representation of an absolute URI. Parameters: escaped - If escaped. Parameters: charset - Charset to use. throws: org.apache.commons.httpclient.URIException - |
UURI | protected UURI(UURI base, UURI relative) throws URIException(Code) | | Parameters: relative - String representation of URI. Parameters: base - Parent UURI to use derelativizing. throws: org.apache.commons.httpclient.URIException - |
charAt | public char charAt(int index)(Code) | | |
coalesceHostAuthorityStrings | protected void coalesceHostAuthorityStrings()(Code) | | The two String fields cachedHost and cachedAuthorityMinusUserInfo are
usually identical; if so, coalesce into a single instance.
|
coalesceUriStrings | protected void coalesceUriStrings()(Code) | | The two String fields cachedString and cachedEscapedURI are
usually identical; if so, coalesce into a single instance.
|
equals | public boolean equals(Object obj)(Code) | | Test an object if this UURI is equal to another.
Parameters: obj - an object to compare true if two URI objects are equal |
from | public static UURI from(Object o)(Code) | | Convenience method for finding the UURI inside an
Object likely to have (or be/imply) one.
Parameters: o - Object that is, has, or implies a UURI the UURI found, or null if none |
getAuthorityMinusUserinfo | public String getAuthorityMinusUserinfo() throws URIException(Code) | | Return the authority minus userinfo (if any).
If no userinfo present, just returns the authority.
The authority stripped of any userinfo if present. throws: URIException - |
getEscapedURI | public synchronized String getEscapedURI()(Code) | | |
getHost | public synchronized String getHost() throws URIException(Code) | | |
getHostBasename | public String getHostBasename() throws URIException(Code) | | Strips www variants from the host.
Strips www[0-9]*\. from the host. If calling getHostBaseName becomes a
performance issue we should consider adding the hostBasename member that
is set on initialization.
Host's basename. throws: URIException - |
getReferencedHost | public String getReferencedHost() throws URIException(Code) | | Return the referenced host in the UURI, if any, also extracting the
host of a DNS-lookup URI where necessary.
the target or topic host of the URI throws: URIException - |
getSurtForm | public String getSurtForm()(Code) | | Return the 'SURT' format of this UURI |
hasScheme | public static boolean hasScheme(String possibleUrl)(Code) | | Test if passed String has likely URI scheme prefix.
Parameters: possibleUrl - URL string to examine. True if passed string looks like it could be an URL. |
length | public int length()(Code) | | |
resolve | public UURI resolve(String uri) throws URIException(Code) | | Parameters: uri - URI as string that is resolved relative to this UURI. UURI that uses this UURI as base. throws: URIException - |
resolve | public UURI resolve(String uri, boolean e) throws URIException(Code) | | Parameters: uri - URI as string that is resolved relative to this UURI. Parameters: e - True if escaped. UURI that uses this UURI as base. throws: URIException - |
resolve | public UURI resolve(String uri, boolean e, String charset) throws URIException(Code) | | Parameters: uri - URI as string that is resolved relative to this UURI. Parameters: e - True if uri is escaped. Parameters: charset - Charset to use. UURI that uses this UURI as base. throws: URIException - |
toString | public synchronized String toString()(Code) | | Override to cache result
String representation of this URI |
|
|