Java HTTP Header setHeader(HttpURLConnection con, Map headers)

Here you can find the source of setHeader(HttpURLConnection con, Map headers)

Description

set Header

License

Artistic License

Declaration

public static void setHeader(HttpURLConnection con, Map headers) 

Method Source Code

//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*/
    }
}

Related

  1. getURLHeaders(String u)
  2. printHeaderFields(final URL url)
  3. printHttpURLConnectionHeaders(HttpURLConnection httpURLConnection)
  4. readHeadersFromResponse(HttpURLConnection httpURLConnection)
  5. setHeader(final HttpURLConnection couchdbConnection, final String headerName, final String headerValue)
  6. setHeader(HttpURLConnection urlConnection, String key, String value)
  7. setHeaders(HttpURLConnection conn, List headers, String encoding)
  8. setHeadersToRequest(HttpURLConnection urlConnection, Map headersMap)
  9. submitHttpRequest(String url, Map headers, String data)