在java代码中检查url是否存在
//To determine whether the shop instance exists
private boolean postconnection(String url) {HttpClient httpClient = new HttpClient();
PostMethod post=new PostMethod(url);
boolean result=false;
try {
int statusCode = httpClient.executeMethod(post);
if (statusCode == HttpStatus.SC_OK)
result=true;
} catch (IOException e) {
log.info("Connenct failure:url="+url+" and "+e);
}finally{
post.releaseConnection();
}
return result;
}