Add WebTestClientConfigurer

Issue: SPR-15674
This commit is contained in:
Rossen Stoyanchev
2017-06-23 14:45:46 -04:00
parent 4db0ce12e1
commit 8fc3b3bc37
11 changed files with 260 additions and 253 deletions

View File

@@ -96,6 +96,19 @@ public class WebHttpHandlerBuilder {
this.webHandler = webHandler;
}
/**
* Copy constructor.
*/
private WebHttpHandlerBuilder(WebHttpHandlerBuilder other) {
this.webHandler = other.webHandler;
this.filters.addAll(other.filters);
this.exceptionHandlers.addAll(other.exceptionHandlers);
this.sessionManager = other.sessionManager;
this.codecConfigurer = other.codecConfigurer;
this.localeContextResolver = other.localeContextResolver;
}
/**
* Static factory method to create a new builder instance.
@@ -263,6 +276,14 @@ public class WebHttpHandlerBuilder {
return adapted;
}
/**
* Clone this {@link WebHttpHandlerBuilder}.
* @return the cloned builder instance
*/
public WebHttpHandlerBuilder cloneBuilder() {
return new WebHttpHandlerBuilder(this);
}
private static class SortedBeanContainer {

View File

@@ -16,6 +16,7 @@
package org.springframework.web.server.handler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -40,7 +41,7 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
public ExceptionHandlingWebHandler(WebHandler delegate, List<WebExceptionHandler> handlers) {
super(delegate);
this.exceptionHandlers = Collections.unmodifiableList(handlers);
this.exceptionHandlers = Collections.unmodifiableList(new ArrayList<>(handlers));
}