public class URLUtil
extends java.lang.Object
Constructor and Description |
---|
URLUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
enforceHttpProtocol(java.lang.String url)
Given a URL of type String, this method will make sure that HTTP or HTTPS has been places at the start.
|
static java.io.InputStream |
getInputStream(java.net.URL url)
Opens an input stream to the URL, accepts GZIP encoding.
|
static java.net.URL |
getURL(java.lang.String urlStr)
Returns a URL from a String, throws a SdmxException if the URL String is not a valid URL
|
static boolean |
isUrlEncoded(java.lang.String url,
java.lang.String charSet)
Tests if the current url has been encoded.
|
static boolean |
urlExists(java.net.URL url)
Returns true if the HTTP Status is any of the following values:
1xx - Informational
2xx - Successful
3xx - Redirection
401 Unauthorized
402 Payment Required
405 Method Not Allowed
407 Proxy Authentication Required
|
public static java.io.InputStream getInputStream(java.net.URL url)
url
- public static java.net.URL getURL(java.lang.String urlStr)
urlStr
- public static boolean urlExists(java.net.URL url)
fileUri
- public static boolean isUrlEncoded(java.lang.String url, java.lang.String charSet) throws java.io.UnsupportedEncodingException
url
- charSet
- - the decoding charset to use. example "UTF-8"java.io.UnsupportedEncodingException
- - If character encoding needs to be consulted, but named character encoding is not supportedpublic static java.lang.String enforceHttpProtocol(java.lang.String url)
Given a URL of type String, this method will make sure that HTTP or HTTPS has been places at the start.
For example. if url is "localhost:8080/FusionRegistry", then this method will concatenate http to the start.
If the URL has https or http at the start, then it will just return it back
url
-