Consumer methods for WebHttpHandlerBuilder

Replace the more limited List-based methods to add filtes and exception
handlers with Consumer<List<?>> variants.
This commit is contained in:
Rossen Stoyanchev
2017-06-23 07:12:10 -04:00
parent 782c595cf7
commit c37c59f578
7 changed files with 32 additions and 55 deletions

View File

@@ -197,8 +197,8 @@ public abstract class RouterFunctions {
WebHandler webHandler = toWebHandler(routerFunction, strategies);
return WebHttpHandlerBuilder.webHandler(webHandler)
.filters(strategies.webFilters())
.exceptionHandlers(strategies.exceptionHandlers())
.filters(filters -> filters.addAll(strategies.webFilters()))
.exceptionHandlers(handlers -> handlers.addAll(strategies.exceptionHandlers()))
.localeContextResolver(strategies.localeContextResolver())
.build();
}

View File

@@ -63,7 +63,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
wac.refresh();
return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac))
.exceptionHandlers(Collections.singletonList(new ResponseStatusExceptionHandler()))
.exceptionHandler(new ResponseStatusExceptionHandler())
.build();
}