public class UrlUtils
extends java.lang.Object
HttpClientWrapper.| Constructor and Description |
|---|
UrlUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getAccessError(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout) |
static java.lang.String |
getAccessError(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory) |
static boolean |
isAvailable(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout)
Check if the HTTP resource specified by the destination URL is available.
|
static boolean |
isAvailable(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
Check if the HTTP resource specified by the destination URL is available.
|
static boolean |
isAvailable(java.lang.String destinationUrl,
boolean fireRequest,
int timeout)
Check if the HTTP resource specified by the destination URL is available.
|
static java.lang.String |
retrieveData(java.lang.String sUrl,
int timeout)
Download data from an URL.
|
static java.lang.String |
retrieveData(java.lang.String sUrl,
java.lang.String encoding,
int timeout)
Download data from an URL, if necessary converting from a character encoding.
|
static java.lang.String |
retrieveData(java.lang.String sUrl,
java.lang.String encoding,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
Download data from an URL, if necessary converting from a character encoding.
|
static java.lang.String |
retrieveDataPost(java.lang.String sUrl,
java.lang.String encoding,
java.lang.String postRequestBody,
java.lang.String contentType,
int timeout)
Download data from an URL with a POST request, if necessary converting from a character encoding.
|
static java.lang.String |
retrieveDataPost(java.lang.String sUrl,
java.lang.String encoding,
java.lang.String postRequestBody,
java.lang.String contentType,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
Download data from an URL with a POST request, if necessary converting from a character encoding.
|
static byte[] |
retrieveRawData(java.lang.String sUrl,
int timeout)
Download data from an URL and return the raw bytes.
|
static byte[] |
retrieveRawData(java.lang.String sUrl,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
Download data from an URL and return the raw bytes.
|
public static java.lang.String retrieveData(java.lang.String sUrl,
int timeout)
throws java.io.IOException
sUrl - The full URL used to download the content.java.io.IOException - If accessing the resource fails.public static java.lang.String retrieveData(java.lang.String sUrl,
java.lang.String encoding,
int timeout)
throws java.io.IOException
sUrl - The full URL used to download the content.encoding - An encoding, e.g. UTF-8, ISO-8859-15. Can be null.timeout - The timeout in milliseconds that is used for both
connection timeout and read timeout.java.io.IOException - If accessing the resource fails.public static java.lang.String retrieveData(java.lang.String sUrl,
java.lang.String encoding,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
throws java.io.IOException
sUrl - The full URL used to download the content.encoding - An encoding, e.g. UTF-8, ISO-8859-15. Can be null.timeout - The timeout in milliseconds that is used for both
connection timeout and read timeout.sslFactory - The SSLFactory to use for the connection, this allows to support custom SSL certificatesjava.io.IOException - If accessing the resource fails.public static byte[] retrieveRawData(java.lang.String sUrl,
int timeout)
throws java.io.IOException
sUrl - The full URL used to download the content.timeout - The timeout in milliseconds that is used for both
connection timeout and read timeout.java.io.IOException - If accessing the resource fails.public static byte[] retrieveRawData(java.lang.String sUrl,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
throws java.io.IOException
sUrl - The full URL used to download the content.timeout - The timeout in milliseconds that is used for both
connection timeout and read timeout.sslFactory - The SSLFactory to use for the connection, this allows to support custom SSL certificatesjava.io.IOException - If accessing the resource fails.public static java.lang.String retrieveDataPost(java.lang.String sUrl,
java.lang.String encoding,
java.lang.String postRequestBody,
java.lang.String contentType,
int timeout)
throws java.io.IOException
sUrl - The full URL used to download the content.encoding - An encoding, e.g. UTF-8, ISO-8859-15. Can be null.postRequestBody - the body of the POST request, e.g. request parameters; must not be nullcontentType - the content-type of the POST request; may be nulltimeout - The timeout in milliseconds that is used for both connection timeout and read timeout.java.io.IOException - If accessing the resource fails.public static java.lang.String retrieveDataPost(java.lang.String sUrl,
java.lang.String encoding,
java.lang.String postRequestBody,
java.lang.String contentType,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
throws java.io.IOException
sUrl - The full URL used to download the content.encoding - An encoding, e.g. UTF-8, ISO-8859-15. Can be null.postRequestBody - the body of the POST request, e.g. request parameters; must not be nullcontentType - the content-type of the POST request; may be nulltimeout - The timeout in milliseconds that is used for both connection timeout and read timeout.sslFactory - The SSLFactory to use for the connection, this allows to support custom SSL certificatesjava.io.IOException - If accessing the resource fails.public static boolean isAvailable(java.lang.String destinationUrl,
boolean fireRequest,
int timeout)
throws java.lang.IllegalArgumentException
destinationUrl - the destination URL to check for availabilityfireRequest - if true a request will be sent to the given URL in addition to opening the
connectiontimeout - Timeout in milliseconds after which the call fails because of timeout.true if a connection could be set up and the response was receivedjava.lang.IllegalArgumentException - if the destination URL is invalidpublic static boolean isAvailable(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout)
throws java.lang.IllegalArgumentException
destinationUrl - the destination URL to check for availabilityfireRequest - if true a request will be sent to the given URL in addition to opening the
connectiontimeout - Timeout in milliseconds after which the call fails because of timeout.true if a connection could be set up and the response was receivedjava.lang.IllegalArgumentException - if the destination URL is invalidpublic static boolean isAvailable(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
throws java.lang.IllegalArgumentException
destinationUrl - the destination URL to check for availabilityfireRequest - if true a request will be sent to the given URL in addition to opening the
connectiontimeout - Timeout in milliseconds after which the call fails because of timeout.sslFactory - The SSLFactory to use for the connection, this allows to support custom SSL certificatestrue if a connection could be set up and the response was receivedjava.lang.IllegalArgumentException - if the destination URL is invalidpublic static java.lang.String getAccessError(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout)
throws java.lang.IllegalArgumentException
destinationUrl - the destination URL to check for availabilityfireRequest - if true a request will be sent to the given URL in addition to opening the
connectionignoreHTTPSHostCheck - if specified true, a HostnameVerifier is registered which accepts all hostnames during SSL handshaketimeout - Timeout in milliseconds after which the call fails because of timeout.java.lang.IllegalArgumentException - if the destination URL is invalidpublic static java.lang.String getAccessError(java.lang.String destinationUrl,
boolean fireRequest,
boolean ignoreHTTPSHostCheck,
int timeout,
javax.net.ssl.SSLSocketFactory sslFactory)
throws java.lang.IllegalArgumentException
destinationUrl - the destination URL to check for availabilityfireRequest - if true a request will be sent to the given URL in addition to opening the
connectionignoreHTTPSHostCheck - if specified true, a HostnameVerifier is registered which accepts all hostnames during SSL handshaketimeout - Timeout in milliseconds after which the call fails because of timeout.sslFactory - The SSLFactory to use for the connection, this allows to support custom SSL certificatesjava.lang.IllegalArgumentException - if the destination URL is invalid