本文整理匯總了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);
}
示例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);
}
}
}
}
示例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();
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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;
}