GetMethod get = new GetMethod("#the url");
try {
HttpClient client = new HttpClient();
client.executeMethod(get);
String ret = get.getResponseBodyAsString();
if(ret.startsWith("ok")) {
return true;
}else {
log.warn("not ok");
return false;
}
}catch(Exception e) {
return true;
}finally {
if(null != get) {
get.releaseConnection();
}
}
httpclient的用法
最新推荐文章于 2024-11-04 16:47:59 发布