Libraryless. Click here for Pure Java version (2848L/17K).
// -1 in case of error static int returnCodeHttpHEADWithTimeout(int timeout, String url) { url = absoluteURL(url); HttpURLConnection conn = null; InputStream in = null; try { conn = (HttpURLConnection) new URL(url).openConnection(); setURLConnectionTimeouts(conn, timeout); conn.setRequestMethod("HEAD"); conn.setRequestProperty("X-No-Cookies", "1"); in = conn.getInputStream(); ret conn.getResponseCode(); } catch (IOException e) { silentException(e); ret -1; } finally { closeURLConnection(conn, in); } }
Began life as a copy of #1018964
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018970 |
Snippet name: | returnCodeHttpHEADWithTimeout |
Eternal ID of this version: | #1018970/4 |
Text MD5: | 24e77c8b3c0a763917e3de5535926e75 |
Transpilation MD5: | 97da0d5b8b1c81d03e3649af7d3854e4 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-18 16:56:03 |
Source code size: | 576 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 355 / 411 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031399 - returnCodeHttpHEADWithTimeout_passOnExceptions |