Here you can find the source of addHeaders(Map
private static void addHeaders(Map<String, String> headers, URLConnection c)
//package com.java2s; //License from project: Apache License import java.net.URLConnection; import java.util.Map; import java.util.Map.Entry; public class Main { private static void addHeaders(Map<String, String> headers, URLConnection c) { if (headers != null) { for (Entry<String, String> e : headers.entrySet()) { c.setRequestProperty(e.getKey(), e.getValue()); }/* www . j a v a 2 s . c om*/ } } }