Java HTTP Header getHttpResponseHeader(HttpURLConnection http)

Here you can find the source of getHttpResponseHeader(HttpURLConnection http)

Description

get Http Response Header

License

Apache License

Declaration

public static Map<String, String> getHttpResponseHeader(HttpURLConnection http)
        throws UnsupportedEncodingException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;

import java.util.LinkedHashMap;

import java.util.Map;

public class Main {

    public static Map<String, String> getHttpResponseHeader(HttpURLConnection http)
            throws UnsupportedEncodingException {
        Map<String, String> header = new LinkedHashMap<String, String>();
        for (int i = 0;; i++) {
            String mine = http.getHeaderField(i);
            if (mine == null)
                break;
            header.put(http.getHeaderFieldKey(i), mine);
        }//  w  w w .java  2 s.c om
        return header;
    }
}

Related

  1. fillHeaders(HttpURLConnection urlConnection, Map headers)
  2. GET_Stream(String url, HashMap headers)
  3. getConnection(URL url, String method, Map header, String ctype)
  4. getFromUrl(Map headerMap, URL loc, Proxy proxy)
  5. getHeaderField(final URL url, final String name)
  6. getIntFromHeader(HttpURLConnection connection, String headerName)
  7. getLastModifiedHeader(URL url)
  8. getServerHeader(URL httpURL)
  9. getURLHeaders(String u)