Here you can find the source of setHeader(HttpURLConnection con, Map headers)
public static void setHeader(HttpURLConnection con, Map headers)
//package com.java2s; //License from project: Artistic License import java.net.HttpURLConnection; import java.util.Iterator; import java.util.Map; public class Main { public static void setHeader(HttpURLConnection con, Map headers) { Iterator iter = headers.keySet().iterator(); while (iter.hasNext()) { String key = (String) iter.next(); con.setRequestProperty(key, (String) headers.get(key)); }/* ww w.j av a2 s . com*/ } }