Gets the response headers of specified uri.

@param uri http/https uri

@return response headers

@throws IOException in case of any IO related issue
761408
public static Header[] headUri(String uri) throws IOException {
        CloseableHttpClient c = newHttpClient(new URL(uri));
        HttpHead head = new HttpHead(uri);
        LOG.debug("HEAD {}", uri);
        CloseableHttpResponse res = c.execute(head, HttpClientContext.create());
        checkResponse(res);
        return res.getAllHeaders();
    }
939402
public HttpMessage uri(final String requestUri) {
        setHeader(DynamicEndpointUriResolver.ENDPOINT_URI_HEADER_NAME, requestUri);
        setHeader(HttpMessageHeaders.HTTP_REQUEST_URI, requestUri);
        return this;
    }
410334
@Override
    public Collection<String> getHeaders(String name) {
        return (headers != null ? headers.get(name) : null);
    }
1300703
public static VcfHeader header(final URL url) throws IOException {
        checkNotNull(url);
        try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
            return header(reader);
        }
    }
750516
protected String getCharsetFromHeaders(HttpHeaders headers) 
	throws IOException {
		if(headers == null) {
			return null;
		}
		for(HttpHeader header : headers) {
			if(header.getName().toUpperCase().trim().equals(
					HTTP_CONTENT_TYPE_HEADER)) {
				return contentTypeToCharset(header.getValue());
			}
		}
		return null;
	}
536511
public Map<String, List<String>> getHeaders() {
        if (headers == null) {
            return null;
        }
        return headers.toMultimap();
    }
632538
public static HttpHeaders toArmeria(HttpResponse in) {
        final io.netty.handler.codec.http.HttpHeaders inHeaders = in.headers();
        final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
        out.status(in.status().code());

        // Add the HTTP headers which have not been consumed above
        toArmeria(inHeaders, out);
        return out;
    }
1310668
public static Reader uriReader(URI uri) throws IOException {
        return new BufferedReader(new InputStreamReader(uri.toURL().openStream(), StandardCharsets.UTF_8));
    }
1233527
public static String getResponseAsString(URI uri, Header header) {
        return getResponseAsString(uri.toString(), header);
    }
1080465
protected HttpRequest createHttpRequest(URI uri, HttpMethod method) {
        HttpRequest request = new HttpRequest();
        request.setUri(uri);
        request.setMethod(method);

        // Set authorization header
        request.setHeaders(createHeaders());

        return request;
    }
453132
public static HttpClientRequest<ByteBuf> createRequest(URI uri) {
        String uriToUse = stripUserInfoFromUriIfDefined(uri).toASCIIString();
        HttpClientRequest<ByteBuf> request = HttpClientRequest.createGet(uriToUse);

        if (uri.getUserInfo() != null) {
            logger.debug("Adding basic authentication header for URI {}", uriToUse);
            String basicAuth = "Basic " + Base64.getEncoder().encodeToString(uri.getUserInfo().getBytes(UTF_8));
            request.withHeader("Authorization", basicAuth);
        }

        return request;
    }
1299049
public static Map<String,String> buildHeaders( String reqCorsHeader, String requestUri ) {

		Map<String,String> result = new LinkedHashMap<> ();
		result.put( CORS_ALLOW_ORIGIN, requestUri );
		result.put( CORS_ALLOW_METHODS, VALUE_ALLOWED_METHODS );
		result.put( CORS_ALLOW_CREDENTIALS, VALUE_ALLOW_CREDENTIALS );

		if( ! Utils.isEmptyOrWhitespaces( reqCorsHeader ))
			result.put( CORS_ALLOW_HEADERS, reqCorsHeader );

		return result;
	}
889525
public static String get(String url,
                             Map<String, String> headers,
                             String params) throws IOException {

        // 参数
        if (StringUtil.isNotEmpty(params)) {
            url += "?" + params;
        }

        HttpURLConnection httpUrlConn = httpUrlConn(url);
        httpUrlConn.setDoInput(true);
        httpUrlConn.setRequestMethod(Constant.RequestMethodGet);

        // header
        if (headers != null) {
            header(headers, httpUrlConn);
        }

        httpUrlConn.connect();

        return readIO(httpUrlConn);
    }
346925
private String getResponseContent(CachingClientHttpResponseWrapper response) throws IOException {
        if (response != null) {
            StringBuilder builder = new StringBuilder();
            
            builder.append("HTTP/1.1 "); // TODO get Http version from message
            builder.append(response.getStatusCode());
            builder.append(" ");
            builder.append(response.getStatusText());
            builder.append(NEWLINE);
            
            appendHeaders(response.getHeaders(), builder);
            
            builder.append(NEWLINE);
            builder.append(response.getBodyContent());
            
            return builder.toString();
        } else {
            return "";
        }
    }
69011
def get(self, uri, disable_proxy=False, stream=False):
        """"""
        response = requests.get(
            uri,
            headers=self.headers,
            allow_redirects=True,
            cookies={},
            stream=stream,
            proxies=self.proxy if not disable_proxy else False
        )

        if response.status_code in _PERMITTED_STATUS_CODES:
            self.response_headers = response.headers
            return response.content if not stream else response.iter_content()
        else:
            raise requests.exceptions.HTTPError(
                "HTTP response did not have a permitted status code."
            )
1186839
public static String getResponseAsString(String uri, String charsetName) {
        return HttpRequester.getResponseAsString(uri, charsetName);
    }
811250
public static String getHeaders(HttpServletResponse response) {
        String headerString = "";
        Collection<String> headerNames = response.getHeaderNames();
        for (String headerName : headerNames) {
            // there may be multiple headers per header name
            for (String headerValue : response.getHeaders(headerName)) {
                if (headerString.length() != 0) {
                    headerString += "\n";
                }

                headerString += headerName + ": " + headerValue;
            }
        }

        return headerString;
    }