mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
extract timeout constants
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@50 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
7776ca7609
commit
d847d023a7
1 changed files with 4 additions and 2 deletions
|
@ -41,6 +41,8 @@ public final class ParserUtils
|
|||
{
|
||||
private static final String SCRAPE_USER_AGENT = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)";
|
||||
private static final int SCRAPE_INITIAL_CAPACITY = 4096;
|
||||
private static final int SCRAPE_CONNECT_TIMEOUT = 5000;
|
||||
private static final int SCRAPE_READ_TIMEOUT = 10000;
|
||||
|
||||
public static CharSequence scrape(final String url) throws IOException
|
||||
{
|
||||
|
@ -53,8 +55,8 @@ public final class ParserUtils
|
|||
final URLConnection connection = new URL(url).openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(request != null);
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setReadTimeout(10000);
|
||||
connection.setConnectTimeout(SCRAPE_CONNECT_TIMEOUT);
|
||||
connection.setReadTimeout(SCRAPE_READ_TIMEOUT);
|
||||
connection.addRequestProperty("User-Agent", SCRAPE_USER_AGENT);
|
||||
|
||||
if (request != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue