Java HTTP Header addHeadersToRequest(HttpURLConnection request, Map headers)

Here you can find the source of addHeadersToRequest(HttpURLConnection request, Map headers)

Description

add Headers To Request

License

Open Source License

Declaration

public static void addHeadersToRequest(HttpURLConnection request, Map<String, String> headers) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.HttpURLConnection;

import java.util.Map;

public class Main {
    public static void addHeadersToRequest(HttpURLConnection request, Map<String, String> headers) {
        if (headers != null) {
            for (String key : headers.keySet()) {
                request.addRequestProperty(key, headers.get(key));
            }/*from  w w  w  .  ja  va  2  s .c om*/
        }
    }
}

Related

  1. addCustomHeaders(HttpURLConnection conn, Map headers)
  2. addHeader(HttpURLConnection conn, String headerName, String value)
  3. copyHttpHeaders(@Nonnull final HttpURLConnection aConn, @Nonnull final InternetHeaders aHeaders)
  4. createHttpConnection(URL endpointUrl, String httpMethod, Map headers)
  5. delete(String url, Map headers)
  6. doDelete(URL endpoint, Map headers)