Here you can find the source of dumpHeaders(HttpURLConnection conn)
public static void dumpHeaders(HttpURLConnection conn)
//package com.java2s; //License from project: Open Source License import java.net.*; public class Main { public static void dumpHeaders(HttpURLConnection conn) { String name;/* www . j a v a2 s .co m*/ String value; for (int i = 0; i < 20; i++) { name = conn.getHeaderFieldKey(i); value = conn.getHeaderField(i); if (name == null && value == null) break; System.out.println(name + "=" + value); } System.out.println(); } }