后面检测网站是否挂掉
用ajax发送同步请求来判断网站是否挂掉不能解决跨域访问的问题。。
可以在后台用定时任务去检测试
代码如下:
publicvoidhttpConnetion(StringurlStr,AsformwebSitewebSite){
URLurl=null;
try{
url=newURL(urlStr);
URLConnectionURLconnection=url.openConnection();
HttpURLConnectionhttpConnection=(HttpURLConnection)URLconnection;
intresponseCode=httpConnection.getResponseCode();
System.out.println(responseCode);
if(responseCode==HttpURLConnection.HTTP_OK){//HTTP_OK为200
}else{
//oa提醒
addRemind(webSite);
//短信提醒
sendSm(webSite.getF5(),"网站'"+webSite.getF2()+"'出现异常,请检查网站服务!");
}
}catch(Exceptione){
//oa提醒
addRemind(webSite);
//短信提醒
sendSm(webSite.getF5(),"网站'"+webSite.getF2()+"'出现异常,请检查网站服务!");
}
}
相关推荐
86193952 2020-10-27
83911535 2020-11-13
87403867 2020-09-24
88550291 2020-08-21
88407710 2020-08-17
xvzhengyang 2020-07-30
knightwatch 2020-07-19
knightwatch 2020-07-04
hygbuaa 2020-06-26
sicceer 2020-06-21
88407013 2020-06-16
86447405 2020-06-16
zkwgpp 2020-06-14
DumbbellYang 2020-06-11
标题无所谓 2020-06-10
hygbuaa 2020-06-10
zkwgpp 2020-06-02
zhaolisha 2020-05-31