public class UrlUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COOKIE |
static String |
COOKIE_VALUE_DELIMITER |
static SafeSimpleDateFormat |
DATE_FORMAT |
static char |
DOT |
static String |
EXPIRES |
static char |
NAME_VALUE_SEPARATOR |
static String |
PATH |
static String |
SET_COOKIE |
static String |
SET_COOKIE_SEPARATOR |
Modifier and Type | Method and Description |
---|---|
static void |
disconnect(HttpURLConnection c) |
static URLConnection |
getConnection(String url,
boolean input,
boolean output,
boolean cache) |
static URLConnection |
getConnection(URL url,
boolean input,
boolean output,
boolean cache) |
static String |
getContentFromUrl(String url,
Map inCookies,
Map outCookies)
Cookie Maps can be null.
|
static String |
getCookieDomainFromHost(String host) |
static void |
getCookies(URLConnection conn,
Map store)
Retrieves and stores cookies returned by the host on the other side of
the open java.net.URLConnection.
|
static String |
getHostName() |
static String |
getUserAgent() |
static void |
readErrorResponse(URLConnection c) |
static void |
setCookies(URLConnection conn,
Map store)
Prior to opening a URLConnection, calling this method will set all
unexpired cookies that match the path or subpaths for thi underlying URL
The connection MUST NOT have been opened
method or an IOException will be thrown.
|
static void |
setReferer(String referer) |
static void |
setTimeouts(URLConnection c,
int read,
int connect) |
static void |
setUserAgent(String userAgent) |
public static final String SET_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 String SET_COOKIE_SEPARATOR
public static final String COOKIE
public static final char NAME_VALUE_SEPARATOR
public static final char DOT
public static void setReferer(String referer)
public static void setUserAgent(String userAgent)
public static String getUserAgent()
public static URLConnection getConnection(String url, boolean input, boolean output, boolean cache) throws IOException
IOException
public static URLConnection getConnection(URL url, boolean input, boolean output, boolean cache) throws IOException
IOException
public static void setTimeouts(URLConnection c, int read, int connect)
public static void readErrorResponse(URLConnection c)
public static void disconnect(HttpURLConnection c)
public static void getCookies(URLConnection conn, Map store)
conn
- a java.net.URLConnection - must be open, or IOException will
be thrownIOException
- Thrown if conn is not open.public static void setCookies(URLConnection conn, Map store) throws IOException
conn
- a java.net.URLConnection - must NOT be open, or IOException will be thrownIOException
- Thrown if conn has already been opened.public static String getContentFromUrl(String url, Map inCookies, Map outCookies)
public static String getHostName()
Copyright © 2013. All rights reserved.