INT-4309 Http Header Mapper VarArgs Instead of []

JIRA: https://jira.spring.io/browse/INT-4309

More convenient for Java Config.

*Upgrade to Reactor 3.1 B-S, Reactor-Netty 0.7 B-S and Security 5.0 B-S.
Otherwise we are not compatible with the latest SF
This commit is contained in:
Gary Russell
2017-07-04 17:45:03 -04:00
committed by Artem Bilan
parent 47003077cc
commit 6c62af53f4
3 changed files with 15 additions and 8 deletions

View File

@@ -368,9 +368,11 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
* mapping outbound endpoint request headers.
* @param excludedOutboundStandardRequestHeaderNames the excludedStandardRequestHeaderNames to set
*/
public void setExcludedOutboundStandardRequestHeaderNames(String[] excludedOutboundStandardRequestHeaderNames) {
public void setExcludedOutboundStandardRequestHeaderNames(String... excludedOutboundStandardRequestHeaderNames) {
Assert.notNull(excludedOutboundStandardRequestHeaderNames,
"'excludedOutboundStandardRequestHeaderNames' must not be null");
Assert.noNullElements(excludedOutboundStandardRequestHeaderNames,
"'excludedOutboundStandardRequestHeaderNames' must not have null elements");
this.excludedOutboundStandardRequestHeaderNames = Arrays.copyOf(excludedOutboundStandardRequestHeaderNames,
excludedOutboundStandardRequestHeaderNames.length);
}
@@ -380,9 +382,11 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
* mapping inbound endpoint response headers.
* @param excludedInboundStandardResponseHeaderNames the excludedStandardResponseHeaderNames to set
*/
public void setExcludedInboundStandardResponseHeaderNames(String[] excludedInboundStandardResponseHeaderNames) {
public void setExcludedInboundStandardResponseHeaderNames(String... excludedInboundStandardResponseHeaderNames) {
Assert.notNull(excludedInboundStandardResponseHeaderNames,
"'excludedInboundStandardResponseHeaderNames' must not be null");
Assert.noNullElements(excludedInboundStandardResponseHeaderNames,
"'excludedInboundStandardResponseHeaderNames' must not have null elements");
this.excludedInboundStandardResponseHeaderNames = Arrays.copyOf(excludedInboundStandardResponseHeaderNames,
excludedInboundStandardResponseHeaderNames.length);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@ import org.springframework.util.StopWatch;
* @author Mark Fisher
* @author Gunnar Hillert
* @author Artem Bilan
* @author Gary Russell
* @since 2.0.1
*/
public class DefaultHttpHeaderMapperFromMessageOutboundTests {
@@ -685,7 +686,7 @@ public class DefaultHttpHeaderMapperFromMessageOutboundTests {
public void dontPropagateContentLength() {
DefaultHttpHeaderMapper mapper = DefaultHttpHeaderMapper.outboundMapper();
// not suppressed on outbound request, by default
mapper.setExcludedOutboundStandardRequestHeaderNames(new String[] {"Content-Length"});
mapper.setExcludedOutboundStandardRequestHeaderNames("Content-Length");
Map<String, Object> messageHeaders = new HashMap<String, Object>();
messageHeaders.put("Content-Length", 4);