Here you can find the source of dumpHttpHeaders(HttpURLConnection conn, java.io.PrintStream out)
public static void dumpHttpHeaders(HttpURLConnection conn, java.io.PrintStream out)
//package com.java2s; //License from project: Open Source License import java.util.Map; import java.util.List; import java.net.HttpURLConnection; public class Main { public static void dumpHttpHeaders(HttpURLConnection conn, java.io.PrintStream out) { Map<String, List<String>> map = conn.getHeaderFields(); out.println("Printing All Response Header for URL: " + conn.getURL().toString() + "\n"); for (Map.Entry<String, List<String>> entry : map.entrySet()) { out.println(entry.getKey() + " : " + entry.getValue()); }//w ww . j av a2s. c o m } }