| java.lang.Object org.mortbay.util.URIUtil
URIUtil | public class URIUtil implements Cloneable(Code) | | URI Holder.
This class assists with the decoding and encoding or HTTP URI's.
It differs from the java.net.URL class as it does not provide
communications ability, but it does assist with query string
formatting.
UTF-8 encoding is used by default for % encoded characters. This
may be overridden with the org.mortbay.util.URI.charset system property.
See Also: UrlEncoded author: Greg Wilkins (gregw) |
addPaths | public static String addPaths(String p1, String p2)(Code) | | Add two URI path segments.
Handles null and empty paths, path and query params (eg ?a=b or
;JSESSIONID=xxx) and avoids duplicate '/'
Parameters: p1 - URI path segment Parameters: p2 - URI path segment Legally combined path segments. |
canonicalPath | public static String canonicalPath(String path)(Code) | | Convert a path to a cananonical form.
All instances of "." and ".." are factored out. Null is returned
if the path tries to .. above its root.
Parameters: path - path or null. |
decodePath | public static String decodePath(byte[] buf, int offset, int length)(Code) | | |
encodePath | public static String encodePath(String path)(Code) | | Encode a URI path.
This is the same encoding offered by URLEncoder, except that
the '/' character is not encoded.
Parameters: path - The path the encode The encoded path |
encodePath | public static StringBuffer encodePath(StringBuffer buf, String path)(Code) | | Encode a URI path.
Parameters: path - The path the encode Parameters: buf - StringBuffer to encode path into (or null) The StringBuffer or null if no substitutions required. |
encodeString | public static StringBuffer encodeString(StringBuffer buf, String path, String encode)(Code) | | Encode a URI path.
Parameters: path - The path the encode Parameters: buf - StringBuffer to encode path into (or null) Parameters: encode - String of characters to encode. % is always encoded. The StringBuffer or null if no substitutions required. |
hasScheme | public static boolean hasScheme(String uri)(Code) | | Parameters: uri - URI True if the uri has a scheme |
parentPath | public static String parentPath(String p)(Code) | | Return the parent Path.
Treat a URI like a directory path and return the parent directory.
|
stripPath | public static String stripPath(String path)(Code) | | Strip parameters from a path.
Return path upto any semicolon parameters.
|
|
|