Java HTTP Header addCustomHeaders(HttpURLConnection conn, Map headers)

Here you can find the source of addCustomHeaders(HttpURLConnection conn, Map headers)

Description

add Custom Headers

License

Open Source License

Declaration

private static void addCustomHeaders(HttpURLConnection conn, Map<String, String> headers) 

Method Source Code

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

import java.net.*;
import java.util.*;

public class Main {
    private static void addCustomHeaders(HttpURLConnection conn, Map<String, String> headers) {
        for (Map.Entry<String, String> entry : headers.entrySet()) {
            addHeader(conn, entry.getKey(), entry.getValue());
        }/* w w w. j  a v  a2s .  c  o m*/
    }

    private static void addHeader(HttpURLConnection conn, String headerName, String value) {
        conn.setRequestProperty(headerName, value);
    }
}

Related

  1. addHeader(HttpURLConnection conn, String headerName, String value)
  2. addHeadersToRequest(HttpURLConnection request, Map headers)
  3. copyHttpHeaders(@Nonnull final HttpURLConnection aConn, @Nonnull final InternetHeaders aHeaders)
  4. createHttpConnection(URL endpointUrl, String httpMethod, Map headers)