Libraryless. Click here for Pure Java version (2848L/17K).
1 | // -1 in case of error |
2 | static int returnCodeHttpHEADWithTimeout(int timeout, String url) { |
3 | url = absoluteURL(url); |
4 | HttpURLConnection conn = null; |
5 | InputStream in = null; |
6 | try { |
7 | conn = (HttpURLConnection) new URL(url).openConnection(); |
8 | setURLConnectionTimeouts(conn, timeout); |
9 | conn.setRequestMethod("HEAD"); |
10 | conn.setRequestProperty("X-No-Cookies", "1"); |
11 | in = conn.getInputStream(); |
12 | ret conn.getResponseCode(); |
13 | } catch (IOException e) { |
14 | silentException(e); |
15 | ret -1; |
16 | } finally { |
17 | closeURLConnection(conn, in); |
18 | } |
19 | } |
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: | 354 / 411 |
Version history: | 3 change(s) |
Referenced in: | [show references] |