class UrlUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
FILE
The protocol prefix for "file:" URLs.
|
private static java.lang.String |
JAR
The protocol prefix for "jar:" URLs.
|
private static java.lang.String |
JAR_FILE
The protocol prefix for "jar:file:" URLs.
|
private static java.nio.charset.Charset |
UTF8
The UTF-8 character set, used to decode octets in URLs.
|
Constructor and Description |
---|
UrlUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
decodeUrl(java.lang.String url)
Decodes the specified URL as per RFC 3986, i.e.
|
static java.io.File |
getResourceRoot(java.net.URL url,
java.lang.String resource)
Gets the absolute filesystem path to the class path root for the specified resource.
|
private static final java.nio.charset.Charset UTF8
private static final java.lang.String JAR
private static final java.lang.String FILE
private static final java.lang.String JAR_FILE
public static java.io.File getResourceRoot(java.net.URL url, java.lang.String resource)
url
- The URL to the resource, may be null
.resource
- The name of the resource, must not be null
.null
if the input
URL was null
.public static java.lang.String decodeUrl(java.lang.String url)
URL
which
unfortunately does not enforce proper URLs. As such, this method will leniently accept invalid characters or
malformed percent-encoded octets and simply pass them literally through to the result string. Except for rare
edge cases, this will make unencoded URLs pass through unaltered.url
- The URL to decode, may be null
.null
if the input was null
.