Browse Source

Re-add vararg options in WebHttpHandlerBuilder

WebHttpHandlerBuilder is low level not expected to appear frequently
but they might be repeated more in tests (e.g. of WebFilter's).

Issuse: SPR-15499
pull/1423/head
Rossen Stoyanchev 8 years ago
parent
commit
add1305252
  1. 23
      spring-web/src/main/java/org/springframework/web/server/adapter/WebHttpHandlerBuilder.java

23
spring-web/src/main/java/org/springframework/web/server/adapter/WebHttpHandlerBuilder.java

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.web.server.adapter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@ -147,6 +148,17 @@ public class WebHttpHandlerBuilder { @@ -147,6 +148,17 @@ public class WebHttpHandlerBuilder {
}
/**
* Add the given filter(s).
* @param filters the filter(s) to add
*/
public WebHttpHandlerBuilder filter(WebFilter... filters) {
if (!ObjectUtils.isEmpty(filters)) {
this.filters.addAll(Arrays.asList(filters));
}
return this;
}
/**
* Add the given filters.
* @param filters the filters to add
@ -168,6 +180,17 @@ public class WebHttpHandlerBuilder { @@ -168,6 +180,17 @@ public class WebHttpHandlerBuilder {
return this;
}
/**
* Add the given exception handler(s).
* @param handlers the exception handler(s)
*/
public WebHttpHandlerBuilder exceptionHandler(WebExceptionHandler... handlers) {
if (!ObjectUtils.isEmpty(handlers)) {
this.exceptionHandlers.addAll(Arrays.asList(handlers));
}
return this;
}
/**
* Add the given exception handlers.
* @param handlers the exception handlers

Loading…
Cancel
Save