@Deprecated public final class UrlUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COOKIE
Deprecated.
|
static String |
COOKIE_VALUE_DELIMITER
Deprecated.
|
static SafeSimpleDateFormat |
DATE_FORMAT
Deprecated.
|
static char |
DOT
Deprecated.
|
static String |
EXPIRES
Deprecated.
|
static TrustManager[] |
NAIVE_TRUST_MANAGER
Deprecated.
|
static HostnameVerifier |
NAIVE_VERIFIER
Deprecated.
|
protected static SSLSocketFactory |
naiveSSLSocketFactory
Deprecated.
|
static char |
NAME_VALUE_SEPARATOR
Deprecated.
|
static String |
PATH
Deprecated.
|
static ThreadLocal<String> |
referrer
Deprecated.
|
static String |
SET_COOKIE
Deprecated.
|
static String |
SET_COOKIE_SEPARATOR
Deprecated.
|
static ThreadLocal<String> |
userAgent
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static void |
clearGlobalReferrer()
Deprecated.
|
static void |
clearGlobalUserAgent()
Deprecated.
|
static void |
disconnect(HttpURLConnection c)
Deprecated.
|
static URL |
getActualUrl(String url)
Deprecated.
|
static URLConnection |
getConnection(String url,
boolean input,
boolean output,
boolean cache)
Deprecated.
|
static URLConnection |
getConnection(URL url,
boolean input,
boolean output,
boolean cache)
Deprecated.
|
static URLConnection |
getConnection(URL url,
Map inCookies,
boolean input,
boolean output,
boolean cache,
boolean allowAllCerts)
Deprecated.
Gets a connection from a url.
|
static byte[] |
getContentFromUrl(String url)
Deprecated.
Get content from the passed in URL.
|
static byte[] |
getContentFromUrl(String url,
Map inCookies,
Map outCookies)
Deprecated.
Get content from the passed in URL.
|
static byte[] |
getContentFromUrl(String url,
Map inCookies,
Map outCookies,
boolean allowAllCerts)
Deprecated.
|
static byte[] |
getContentFromUrl(URL url,
boolean allowAllCerts)
Deprecated.
Get content from the passed in URL.
|
static byte[] |
getContentFromUrl(URL url,
Map inCookies,
Map outCookies,
boolean allowAllCerts)
Deprecated.
Get content from the passed in URL.
|
static String |
getContentFromUrlAsString(String url)
Deprecated.
Get content from the passed in URL.
|
static String |
getContentFromUrlAsString(String url,
Map inCookies,
Map outCookies,
boolean trustAllCerts)
Deprecated.
Get content from the passed in URL.
|
static String |
getContentFromUrlAsString(URL url,
boolean allowAllCerts)
Deprecated.
Get content from the passed in URL.
|
static String |
getContentFromUrlAsString(URL url,
Map inCookies,
Map outCookies,
boolean trustAllCerts)
Deprecated.
Get content from the passed in URL.
|
static String |
getCookieDomainFromHost(String host)
Deprecated.
|
static void |
getCookies(URLConnection conn,
Map store)
Deprecated.
Retrieves and stores cookies returned by the host on the other side of
the open java.net.URLConnection.
|
static String |
getReferrer()
Deprecated.
|
static String |
getUserAgent()
Deprecated.
|
static void |
readErrorResponse(URLConnection c)
Deprecated.
|
static void |
setCookies(URLConnection conn,
Map store)
Deprecated.
Prior to opening a URLConnection, calling this method will set all
unexpired cookies that match the path or subpaths for thi underlying URL
|
static void |
setReferrer(String referer)
Deprecated.
|
static void |
setUserAgent(String agent)
Deprecated.
|
public static final ThreadLocal<String> userAgent
public static final ThreadLocal<String> referrer
public static final String SET_COOKIE
public static final String SET_COOKIE_SEPARATOR
public static final String COOKIE
public static final String COOKIE_VALUE_DELIMITER
public static final String PATH
public static final String EXPIRES
public static final SafeSimpleDateFormat DATE_FORMAT
public static final char NAME_VALUE_SEPARATOR
public static final char DOT
public static final TrustManager[] NAIVE_TRUST_MANAGER
public static final HostnameVerifier NAIVE_VERIFIER
protected static SSLSocketFactory naiveSSLSocketFactory
public static void clearGlobalUserAgent()
public static void clearGlobalReferrer()
public static void setReferrer(String referer)
public static String getReferrer()
public static void setUserAgent(String agent)
public static String getUserAgent()
public static void readErrorResponse(URLConnection c)
public static void disconnect(HttpURLConnection c)
public static void getCookies(URLConnection conn, Map store)
The connection MUST have been opened using the connect() method or a IOException will be thrown.
conn
- a java.net.URLConnection - must be open, or IOException will
be thrownpublic static void setCookies(URLConnection conn, Map store) throws IOException
The connection MUST NOT have been opened method or an IOException will be thrown.
conn
- a java.net.URLConnection - must NOT be open, or IOException will be thrownIOException
- Thrown if conn has already been opened.public static String getContentFromUrlAsString(String url)
url
- URL to hitpublic static String getContentFromUrlAsString(URL url, boolean allowAllCerts)
url
- URL to hitallowAllCerts
- true to not verify certificatespublic static String getContentFromUrlAsString(String url, Map inCookies, Map outCookies, boolean trustAllCerts)
url
- URL to hitinCookies
- Map of session cookies (or null if not needed)outCookies
- Map of session cookies (or null if not needed)trustAllCerts
- if true, SSL connection will always be trusted.public static String getContentFromUrlAsString(URL url, Map inCookies, Map outCookies, boolean trustAllCerts)
url
- URL to hitinCookies
- Map of session cookies (or null if not needed)outCookies
- Map of session cookies (or null if not needed)trustAllCerts
- if true, SSL connection will always be trusted.public static byte[] getContentFromUrl(String url)
url
- URL to hitpublic static byte[] getContentFromUrl(URL url, boolean allowAllCerts)
url
- URL to hitpublic static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies, boolean allowAllCerts)
public static byte[] getContentFromUrl(URL url, Map inCookies, Map outCookies, boolean allowAllCerts)
url
- URL to hitinCookies
- Map of session cookies (or null if not needed)outCookies
- Map of session cookies (or null if not needed)allowAllCerts
- override certificate validation?public static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies)
url
- URL to hitinCookies
- Map of session cookies (or null if not needed)outCookies
- Map of session cookies (or null if not needed)public static URLConnection getConnection(String url, boolean input, boolean output, boolean cache) throws IOException
input
- boolean indicating whether this connection will be used for inputoutput
- boolean indicating whether this connection will be used for outputcache
- boolean allow caching (be careful setting this to true for non-static retrievals).IOException
public static URLConnection getConnection(URL url, boolean input, boolean output, boolean cache) throws IOException
input
- boolean indicating whether this connection will be used for inputoutput
- boolean indicating whether this connection will be used for outputcache
- boolean allow caching (be careful setting this to true for non-static retrievals).IOException
public static URLConnection getConnection(URL url, Map inCookies, boolean input, boolean output, boolean cache, boolean allowAllCerts) throws IOException
inCookies
- Supply cookie Map (received from prior setCookies calls from server)input
- boolean indicating whether this connection will be used for inputoutput
- boolean indicating whether this connection will be used for outputcache
- boolean allow caching (be careful setting this to true for non-static retrievals).IOException
public static URL getActualUrl(String url) throws MalformedURLException
MalformedURLException
Copyright © 2023. All rights reserved.