当前位置: 首页>>代码示例>>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;未经允许,请勿转载。