public class UrlUtils
extends java.lang.Object
Constructor and Description |
---|
UrlUtils() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
decodeUrlAsFile(java.net.URL url) |
static java.net.URL |
decodeUrlQuietly(java.net.URL url) |
static java.lang.String |
ensureSlashTail(java.lang.String s) |
static java.net.URL |
ensureSlashTail(java.net.URL u) |
static boolean |
equalsIgnoreLastSlash(java.net.URL u1,
java.net.URL u2)
both urls are processed by sanitizeLastSlash before actual equals.
|
static java.lang.String |
getHostAndPort(java.net.URL url) |
static int |
getPort(java.net.URL url) |
static int |
getSanitizedPort(java.net.URL u) |
static java.net.URL |
guessCodeBase(JNLPFile file) |
static boolean |
isLocalFile(java.net.URL url) |
static boolean |
isValidRFC2396Url(java.net.URL url) |
static java.lang.String |
loadUrl(java.net.URL url) |
static java.lang.String |
loadUrl(java.net.URL url,
java.nio.charset.Charset ch) |
static java.lang.String[] |
loadUrlWithInvalidHeader(java.net.URL url) |
static java.lang.String[] |
loadUrlWithInvalidHeader(java.net.URL url,
java.nio.charset.Charset ch) |
static java.lang.Object[] |
loadUrlWithInvalidHeaderBytes(java.net.URL url) |
static java.net.URL |
normalizeUrl(java.net.URL url) |
static java.net.URL |
normalizeUrl(java.net.URL url,
boolean encodeFileUrls) |
static java.net.URL |
normalizeUrlAndStripParams(java.net.URL url) |
static java.net.URL |
normalizeUrlAndStripParams(java.net.URL url,
boolean encodeFileUrls) |
static java.net.URL |
normalizeUrlQuietly(java.net.URL url) |
static java.net.URL |
normalizeUrlQuietly(java.net.URL url,
boolean encodeFileUrls) |
static java.net.URL |
removeFileName(java.net.URL src)
This function i striping part behind last path delimiter.
|
static java.lang.String |
sanitizeLastSlash(java.lang.String in) |
static java.net.URL |
sanitizeLastSlash(java.net.URL in)
This function is removing all tailing slashes of url and both unix and
windows salshes are supported.
|
static java.lang.String |
setOfUrlsToHtmlList(java.lang.Iterable<java.net.URL> remoteUrls)
Small utility function creating li list from collection of urls
|
static java.lang.String |
stripFile(java.net.URL documentbase) |
static boolean |
urlEquals(java.net.URL u1,
java.net.URL u2)
Compares a URL using string compareNullableStrings of its protocol, host,
port, path, query, and anchor.
|
public static java.net.URL normalizeUrlAndStripParams(java.net.URL url, boolean encodeFileUrls)
public static java.net.URL normalizeUrlAndStripParams(java.net.URL url)
public static boolean isLocalFile(java.net.URL url)
public static java.net.URL decodeUrlQuietly(java.net.URL url)
public static boolean isValidRFC2396Url(java.net.URL url)
public static java.net.URL normalizeUrl(java.net.URL url, boolean encodeFileUrls) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException, java.net.URISyntaxException
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.net.URISyntaxException
public static java.net.URL normalizeUrl(java.net.URL url) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException, java.net.URISyntaxException
java.net.MalformedURLException
java.io.UnsupportedEncodingException
java.net.URISyntaxException
public static java.net.URL normalizeUrlQuietly(java.net.URL url, boolean encodeFileUrls)
public static java.net.URL normalizeUrlQuietly(java.net.URL url)
public static java.io.File decodeUrlAsFile(java.net.URL url)
public static java.net.URL removeFileName(java.net.URL src)
src
- src to be strippedpublic static java.lang.String setOfUrlsToHtmlList(java.lang.Iterable<java.net.URL> remoteUrls)
remoteUrls
- list of urlspublic static java.net.URL sanitizeLastSlash(java.net.URL in) throws java.net.MalformedURLException
in
- url t be sanitizedjava.net.MalformedURLException
- if original url was wrongpublic static java.lang.String sanitizeLastSlash(java.lang.String in)
public static boolean equalsIgnoreLastSlash(java.net.URL u1, java.net.URL u2)
u1
- first url to comapreu2
- secondpublic static java.net.URL guessCodeBase(JNLPFile file)
public static boolean urlEquals(java.net.URL u1, java.net.URL u2)
u1
- first url to compareNullableStringsu2
- second url to compareNullableStringspublic static int getSanitizedPort(java.net.URL u)
public static int getPort(java.net.URL url)
public static java.lang.String getHostAndPort(java.net.URL url)
public static java.net.URL ensureSlashTail(java.net.URL u)
public static java.lang.String ensureSlashTail(java.lang.String s)
public static java.lang.String stripFile(java.net.URL documentbase)
public static java.lang.String loadUrl(java.net.URL url) throws java.io.IOException
java.io.IOException
public static java.lang.String loadUrl(java.net.URL url, java.nio.charset.Charset ch) throws java.io.IOException
java.io.IOException
public static java.lang.Object[] loadUrlWithInvalidHeaderBytes(java.net.URL url) throws java.io.IOException
java.io.IOException
public static java.lang.String[] loadUrlWithInvalidHeader(java.net.URL url) throws java.io.IOException
java.io.IOException
public static java.lang.String[] loadUrlWithInvalidHeader(java.net.URL url, java.nio.charset.Charset ch) throws java.io.IOException
java.io.IOException