當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpHeaders.entrySet方法代碼示例

本文整理匯總了Java中org.springframework.http.HttpHeaders.entrySet方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpHeaders.entrySet方法的具體用法?Java HttpHeaders.entrySet怎麽用?Java HttpHeaders.entrySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.http.HttpHeaders的用法示例。


在下文中一共展示了HttpHeaders.entrySet方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeInternal

import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
@Override
protected ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
	for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
		String headerName = entry.getKey();
		for (String headerValue : entry.getValue()) {
			this.connection.addRequestProperty(headerName, headerValue);
		}
	}

	if (this.connection.getDoOutput() && this.outputStreaming) {
		this.connection.setFixedLengthStreamingMode(bufferedOutput.length);
	}
	this.connection.connect();
	if (this.connection.getDoOutput()) {
		FileCopyUtils.copy(bufferedOutput, this.connection.getOutputStream());
	}

	return new SimpleClientHttpResponse(this.connection);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:SimpleBufferingClientHttpRequest.java

示例2: addHeadersToRequest

import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
/**
 * Add headers to the request that is being built
 * @param headers The headers to add
 * @param requestBuilder The current request
 */
protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) {
    for (Entry<String, List<String>> entry : headers.entrySet()) {
        List<String> values = entry.getValue();
        for(String value : values) {
            if (value != null) {
                requestBuilder.header(entry.getKey(), value);
            }
        }
    }
}
 
開發者ID:jopache,項目名稱:Settings,代碼行數:16,代碼來源:ApiClient.java

示例3: headersToString

import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
private String headersToString(HttpHeaders headers) {
    StringBuilder builder = new StringBuilder();
    for(Entry<String, List<String>> entry : headers.entrySet()) {
        builder.append(entry.getKey()).append("=[");
        for(String value : entry.getValue()) {
            builder.append(value).append(",");
        }
        builder.setLength(builder.length() - 1); // Get rid of trailing comma
        builder.append("],");
    }
    builder.setLength(builder.length() - 1); // Get rid of trailing comma
    return builder.toString();
}
 
開發者ID:jopache,項目名稱:Settings,代碼行數:14,代碼來源:ApiClient.java

示例4: addHeaders

import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
/**
 * Add the given headers to the given HTTP request.
 * @param httpRequest the request to add the headers to
 * @param headers the headers to add
 */
static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {
	for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
		String headerName = entry.getKey();
		if (!headerName.equalsIgnoreCase(HTTP.CONTENT_LEN) &&
				!headerName.equalsIgnoreCase(HTTP.TRANSFER_ENCODING)) {
			for (String headerValue : entry.getValue()) {
				httpRequest.addHeader(headerName, headerValue);
			}
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:HttpComponentsClientHttpRequest.java

示例5: writeHeaders

import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
private void writeHeaders(HttpHeaders headers) {
	for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
		String headerName = entry.getKey();
		for (String headerValue : entry.getValue()) {
			this.connection.addRequestProperty(headerName, headerValue);
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:SimpleStreamingAsyncClientHttpRequest.java

示例6: getHeaders

import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
static Map<String, Collection<String>> getHeaders(HttpHeaders httpHeaders) {
    LinkedHashMap<String, Collection<String>> headers = new LinkedHashMap<>();
    for (Map.Entry<String, List<String>> entry : httpHeaders.entrySet()) {
        headers.put(entry.getKey(), entry.getValue());
    }
    headers.put(HttpHeaders.CONTENT_TYPE, Lists.newArrayList(
            httpHeaders.getContentType().getType().concat("/").concat(httpHeaders.getContentType().getSubtype())));
    return headers;
}
 
開發者ID:zhaoqilong3031,項目名稱:spring-cloud-samples,代碼行數:10,代碼來源:FeignUtils.java


注:本文中的org.springframework.http.HttpHeaders.entrySet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。