MCPcopy Create free account
hub / github.com/Hello-hao/Tbed / exists

Method exists

src/main/java/cn/hellohao/utils/GetProtocol.java:63–74  ·  view source on GitHub ↗
(String url,String referer)

Source from the content-addressed store, hash-verified

61 }
62 //是否能连接上
63 private boolean exists(String url,String referer) {
64 try {
65 HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
66 con.setConnectTimeout(3000);
67 con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36");
68 con.setRequestProperty("referer", StringUtils.isBlank(referer)?"no-referrer":referer);
69 System.out.println(con.getResponseCode() );
70 return (con.getResponseCode() == 200);
71 } catch (Exception e) {
72 return false;
73 }
74 }
75
76 public static void main(String[] args){
77

Callers 10

getProtocolMethod · 0.95
deleteLOCImgMethod · 0.80
ImageuploadLOCMethod · 0.80
downLoadFromUrlMethod · 0.80
getFileSize2Method · 0.80
clearsMethod · 0.80
contentToTxtMethod · 0.80
mergeMethod · 0.80
uploadForLocMethod · 0.80
uploadImgMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected