标签:http 超时 gettime int lex lag substring ddr false
}
/**
* @ 获得两个日期之间的 格式化的日期(天)集合
*/
public static List<String> getMMDDList(String start, String end) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdfout = new SimpleDateFormat("MMdd");
List<String> list = new ArrayList<String>();
try {
Date date_start = sdf.parse(start);
Date date_end = sdf.parse(end);
Date date = date_start;
Calendar cd = Calendar.getInstance();
while (date.getTime() <= date_end.getTime()) {
list.add(sdfout.format(date));
cd.setTime(date);
cd.add(Calendar.DATE, 1);// 添加一天
date = cd.getTime();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
/**
*
* @方法名:testWsdlConnection
* @功能说明:測试webservice地址是否可用
* @return
*/
public static boolean testWsdlConnection(String address){
boolean flag = false;
try {
URL urlObj = new URL(address);
HttpURLConnection oc = (HttpURLConnection) urlObj.openConnection();
oc.setUseCaches(false);
oc.setConnectTimeout(5000);
//设置超时时间5s
int status = oc.getResponseCode();//请求状态
if(200 == status){
return true;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}catch (Exception e) {
e.printStackTrace();
}
return flag;
}
标签:http 超时 gettime int lex lag substring ddr false
原文地址:http://www.cnblogs.com/zhchoutai/p/7044907.html