本文整理匯總了Java中org.springframework.http.HttpHeaders.setAll方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpHeaders.setAll方法的具體用法?Java HttpHeaders.setAll怎麽用?Java HttpHeaders.setAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.http.HttpHeaders
的用法示例。
在下文中一共展示了HttpHeaders.setAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRequestEntity
import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
protected HttpEntity<?> getRequestEntity() {
HttpHeaders requestHeaders = new HttpHeaders();
if (this.securityProperties != null) {
requestHeaders.setAll(securityProperties);
}
HttpEntity<?> requestEntity = new HttpEntity(requestHeaders);
return requestEntity;
}
示例2: merge
import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
public static HttpHeaders merge(HttpHeaders... headers) {
if (headers == null) {
throw new IllegalArgumentException("headers");
}
if (headers.length == 1) {
return headers[0];
}
HttpHeaders header = new HttpHeaders();
for (HttpHeaders h : headers) {
header.setAll(h.toSingleValueMap());
}
return header;
}
示例3: assign
import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
public static void assign(HttpHeaders header, HttpHeaders... headers) {
if (header == null) {
throw new IllegalArgumentException("header");
}
if (headers == null) {
throw new IllegalArgumentException("headers");
}
if (headers.length == 0) {
return;
}
for (HttpHeaders h : headers) {
header.setAll(h.toSingleValueMap());
}
}
示例4: translate
import org.springframework.http.HttpHeaders; //導入方法依賴的package包/類
@Override
public ResponseEntity<OAuth2Exception> translate(Exception e)
throws Exception {
ResponseEntity<OAuth2Exception> responseEntity = super.translate(e);
OAuth2Exception body = responseEntity.getBody();
HttpHeaders headers = new HttpHeaders();
headers.setAll(responseEntity.getHeaders().toSingleValueMap());
// do something with header or response
return new ResponseEntity<>(body, headers, responseEntity.getStatusCode());
}