|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectxsmeral.semnet.crawler.util.ConnectionManager
public class ConnectionManager
Provides consistent network settings across classes using HttpURLConnections.
Constructor Summary | |
---|---|
ConnectionManager()
|
Method Summary | |
---|---|
static HttpURLConnection |
getConnection(URL url)
Returns a HttpUrlConnection set up with the defined settings. |
static int |
getConnTimeout()
Corresponds to URLConnection.getConnectTimeout() |
static InputStream |
getInputStream(URL url)
Returns an InputStream to the given URL. |
static InputStream |
getInputStream(URL url,
int retries)
Returns an InputStream to the given URL, possibly retrying the connection. |
static InputStream |
getInputStream(URL url,
int retries,
String referer)
Returns an InputStream to the given URL, possibly retrying the connection. |
static int |
getReadTimeout()
Corresponds to URLConnection.getReadTimeout() |
static String |
getUserAgent()
Returns the User-agent. |
static boolean |
isFollowRedirects()
Corresponds to HttpURLConnection.getFollowRedirects() |
static void |
setConnTimeout(int connTimeout)
Corresponds to URLConnection.setConnectTimeout(int) |
static void |
setFollowRedirects(boolean followRedirects)
Corresponds to HttpURLConnection.setFollowRedirects(boolean) |
static void |
setReadTimeout(int readTimeout)
Corresponds to URLConnection.setReadTimeout(int) |
static void |
setUserAgent(String userAgent)
Same as HttpURLConnection.setRequestProperty("User-Agent", userAgent) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionManager()
Method Detail |
---|
public static int getConnTimeout()
URLConnection.getConnectTimeout()
public static void setConnTimeout(int connTimeout)
URLConnection.setConnectTimeout(int)
public static int getReadTimeout()
URLConnection.getReadTimeout()
public static void setReadTimeout(int readTimeout)
URLConnection.setReadTimeout(int)
public static String getUserAgent()
public static void setUserAgent(String userAgent)
HttpURLConnection.setRequestProperty("User-Agent", userAgent)
public static boolean isFollowRedirects()
HttpURLConnection.getFollowRedirects()
public static void setFollowRedirects(boolean followRedirects)
HttpURLConnection.setFollowRedirects(boolean)
public static HttpURLConnection getConnection(URL url) throws IOException
IOException
public static InputStream getInputStream(URL url, int retries, String referer) throws IOException
IOException
public static InputStream getInputStream(URL url, int retries) throws IOException
IOException
public static InputStream getInputStream(URL url) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |