Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1016489 // getURLHeadersByHEAD

JavaX fragment (include)

1  
static Map<S, L<S>> getURLHeadersByHEAD(String url) ctex {
2  
  url = absoluteURL(url);
3  
  if (!networkAllowanceTest(url)) fail("Not allowed: " + url);
4  
  HttpURLConnection conn = null;
5  
  InputStream in = null;
6  
  try {
7  
    conn = (HttpURLConnection) new URL(url).openConnection();
8  
    conn.setRequestMethod("HEAD");
9  
    conn.setRequestProperty("X-No-Cookies", "1");
10  
    in = conn.getInputStream();
11  
    ret toCIMap(conn.getHeaderFields());
12  
  } finally {
13  
    closeURLConnection(conn, in);
14  
  }
15  
}

Author comment

Began life as a copy of #1002941

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1016489
Snippet name: getURLHeadersByHEAD
Eternal ID of this version: #1016489/5
Text MD5: f2ecbc92dc585d1e79b6b57db19c4bd4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-12 08:17:26
Source code size: 503 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 396
Version history: 4 change(s)
Referenced in: [show references]