....
URL url=new URL(urlString);
HttpURLConnection conn= (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(4*1000);
Map<String, List<String>> headerFields = conn.getHeaderFields();
Set<Entry<String, List<String>>> entrySet = headerFields.entrySet();
Iterator<Entry<String, List<String>>> iterator = entrySet.iterator();
while(iterator.hasNext()) {
Entry<String, List<String>> next = iterator.next();
String key=next.getKey();
List<String> value = next.getValue();
if(key==null)
System.out.println(value.toString());
else
System.out.println(key+":"+value.toString());
}
……
版权声明:本文为draven1122原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。