日期:2014-05-20 浏览次数:20769 次
URL myURL=new URL(url);
HttpURLConnection urlcon=(HttpURLConnection)myURL.openConnection();
urlcon.setConnectTimeout(20*1000);
urlcon.setReadTimeout(20*1000);
//System.setProperty("sun.net.client.defaultConnectTimeout", "20000");
//System.setProperty("sun.net.client.defaultReadTimeout", "20000");
urlcon.setUseCaches(false);
urlcon.setInstanceFollowRedirects(true);
urlcon.connect();