Package org.eclipse.jetty.util
Class URIUtil
java.lang.Object
org.eclipse.jetty.util.URIUtil
- All Implemented Interfaces:
Cloneable
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
URI Utility methods.
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.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddEncodedPaths(String p1, String p2) Deprecated.Add two encoded URI path segments.static URIDeprecated.static StringaddPathQuery(String path, String query) Deprecated.Add a path and a query stringstatic StringDeprecated.Add two Decoded URI path segments.static StringaddQueries(String query1, String query2) Deprecated.Combine two query strings into one.static voidappendSchemeHostPort(StringBuffer url, String scheme, String server, int port) Deprecated.Append scheme, host and port URI prefix, handling IPv6 address encoding and default portsstatic voidappendSchemeHostPort(StringBuilder url, String scheme, String server, int port) Deprecated.Append scheme, host and port URI prefix, handling IPv6 address encoding and default portsstatic StringcanonicalEncodedPath(String path) Deprecated.static StringcanonicalPath(String path) Deprecated.Convert a decoded URI path to a canonical form.static StringcanonicalURI(String uri) Deprecated.Convert a partial URI to a canonical form.static StringcompactPath(String path) Deprecated.Convert a path to a compact form.static StringdecodePath(String path) Deprecated.static StringdecodePath(String path, int offset, int length) Deprecated.static StringdecodeSpecific(String str, String charsToDecode) Deprecated.Decode a raw String and convert any specific URI encoded sequences into characters.static StringencodePath(String path) Deprecated.Encode a URI path.static StringBuilderencodePath(StringBuilder buf, String path) Deprecated.Encode a URI path.static StringencodeSpaces(String str) Deprecated.Encode a raw URI String and convert any raw spaces to their "%20" equivalent.static StringencodeSpecific(String str, String charsToEncode) Deprecated.Encode a raw String and convert any specific characters to their URI encoded equivalent.static StringBuilderencodeString(StringBuilder buf, String path, String encode) Deprecated.Encode a URI path.static booleanequalsIgnoreEncodings(String uriA, String uriB) Deprecated.static booleanequalsIgnoreEncodings(URI uriA, URI uriB) Deprecated.static StringgetJarSource(String uri) Deprecated.static URIgetJarSource(URI uri) Deprecated.static StringgetUriLastPathSegment(URI uri) Deprecated.Given a URI, attempt to get the last segment.static booleanDeprecated.static StringDeprecated.Create a new URI from the arguments, handling IPv6 host encoding and default portsstatic StringBuildernewURIBuilder(String scheme, String server, int port) Deprecated.Create a new URI StringBuilder from the arguments, handling IPv6 host encoding and default portsstatic StringparentPath(String p) Deprecated.Return the parent Path.
-
Field Details
-
SLASH
Deprecated.- See Also:
-
HTTP
Deprecated.- See Also:
-
HTTPS
Deprecated.- See Also:
-
__CHARSET
Deprecated.
-
-
Method Details
-
encodePath
Deprecated.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- Returns:
- The encoded path
-
encodePath
Deprecated.Encode a URI path.- Parameters:
buf- StringBuilder to encode path into (or null)path- The path the encode- Returns:
- The StringBuilder or null if no substitutions required.
-
encodeSpaces
Deprecated.Encode a raw URI String and convert any raw spaces to their "%20" equivalent.- Parameters:
str- input raw string- Returns:
- output with spaces converted to "%20"
-
encodeSpecific
Deprecated.Encode a raw String and convert any specific characters to their URI encoded equivalent.- Parameters:
str- input raw stringcharsToEncode- the list of raw characters that need to be encoded (if encountered)- Returns:
- output with specified characters encoded.
-
decodeSpecific
Deprecated.Decode a raw String and convert any specific URI encoded sequences into characters.- Parameters:
str- input raw stringcharsToDecode- the list of raw characters that need to be decoded (if encountered), leaving all other encoded sequences alone.- Returns:
- output with specified characters decoded.
-
encodeString
Deprecated.Encode a URI path.- Parameters:
buf- StringBuilder to encode path into (or null)path- The path the encodeencode- String of characters to encode. % is always encoded.- Returns:
- The StringBuilder or null if no substitutions required.
-
decodePath
Deprecated. -
decodePath
Deprecated. -
addEncodedPaths
Deprecated.Add two encoded 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 (should be encoded)p2- URI path segment (should be encoded)- Returns:
- Legally combined path segments.
-
addPaths
Deprecated.Add two Decoded URI path segments. Handles null and empty paths. Path and query params (eg ?a=b or ;JSESSIONID=xxx) are not handled- Parameters:
p1- URI path segment (should be decoded)p2- URI path segment (should be decoded)- Returns:
- Legally combined path segments.
-
addPathQuery
Deprecated.Add a path and a query string- Parameters:
path- The path which may already contain contain a queryquery- The query string or null if no query to be added- Returns:
- The path with any non null query added after a '?' or '&' as appropriate.
-
getUriLastPathSegment
Deprecated.Given a URI, attempt to get the last segment.If this is a
jar:file://style URI, then the JAR filename is returned (not the deep!/pathlocation)- Parameters:
uri- the URI to look in- Returns:
- the last segment.
-
parentPath
Deprecated.Return the parent Path. Treat a URI like a directory path and return the parent directory.- Parameters:
p- the path to return a parent reference to- Returns:
- the parent path of the URI
-
canonicalURI
Deprecated.Convert a partial URI to a canonical form.All segments of "." and ".." are factored out. Null is returned if the path tries to .. above its root.
- Parameters:
uri- the encoded URI from the path onwards, which may contain query strings and/or fragments- Returns:
- the canonical path, or null if path traversal above root.
- See Also:
-
canonicalEncodedPath
Deprecated.- Parameters:
path- the encoded URI from the path onwards, which may contain query strings and/or fragments- Returns:
- the canonical path, or null if path traversal above root.
-
canonicalPath
Deprecated.Convert a decoded URI path to a canonical form.All segments of "." and ".." are factored out. Null is returned if the path tries to .. above its root.
- Parameters:
path- the decoded URI path to convert. Any special characters (e.g. '?', "#") are assumed to be part of the path segments.- Returns:
- the canonical path, or null if path traversal above root.
- See Also:
-
compactPath
Deprecated.Convert a path to a compact form. All instances of "//" and "///" etc. are factored out to single "/"- Parameters:
path- the path to compact- Returns:
- the compacted path
-
hasScheme
Deprecated.- Parameters:
uri- URI- Returns:
- True if the uri has a scheme
-
newURI
Deprecated.Create a new URI from the arguments, handling IPv6 host encoding and default ports- Parameters:
scheme- the URI schemeserver- the URI serverport- the URI portpath- the URI pathquery- the URI query- Returns:
- A String URI
-
newURIBuilder
Deprecated.Create a new URI StringBuilder from the arguments, handling IPv6 host encoding and default ports- Parameters:
scheme- the URI schemeserver- the URI serverport- the URI port- Returns:
- a StringBuilder containing URI prefix
-
appendSchemeHostPort
Deprecated.Append scheme, host and port URI prefix, handling IPv6 address encoding and default ports- Parameters:
url- StringBuilder to append toscheme- the URI schemeserver- the URI serverport- the URI port
-
appendSchemeHostPort
Deprecated.Append scheme, host and port URI prefix, handling IPv6 address encoding and default ports- Parameters:
url- StringBuffer to append toscheme- the URI schemeserver- the URI serverport- the URI port
-
equalsIgnoreEncodings
Deprecated. -
equalsIgnoreEncodings
Deprecated. -
addPath
Deprecated.- Parameters:
uri- A URI to add the path topath- A decoded path element- Returns:
- URI with path added.
-
addQueries
Deprecated.Combine two query strings into one. Each query string should not contain the beginning '?' character, but may contain multiple parameters separated by the '&' character.- Parameters:
query1- the first query string.query2- the second query string.- Returns:
- the combination of the two query strings.
-
getJarSource
Deprecated. -
getJarSource
Deprecated.
-