@Override protected WebHttpHandlerBuilder initHttpHandlerBuilder() { WebHandler webHandler = RouterFunctions.toWebHandler(this.routerFunction, this.handlerStrategies); return WebHttpHandlerBuilder.webHandler(webHandler) .filters(filters -> filters.addAll(this.handlerStrategies.webFilters())) .exceptionHandlers(handlers -> handlers.addAll(this.handlerStrategies.exceptionHandlers())) .localeContextResolver(this.handlerStrategies.localeContextResolver()); }
.orderedStream() .collect(Collectors.toList()); builder.exceptionHandlers(handlers -> handlers.addAll(exceptionHandlers));
/** * Convert the given {@linkplain RouterFunction router function} into a {@link HttpHandler}, * using the given strategies. * <p>The returned {@code HttpHandler} can be adapted to run in * <ul> * <li>Servlet 3.1+ using the * {@link org.springframework.http.server.reactive.ServletHttpHandlerAdapter},</li> * <li>Reactor using the * {@link org.springframework.http.server.reactive.ReactorHttpHandlerAdapter},</li> * <li>Undertow using the * {@link org.springframework.http.server.reactive.UndertowHttpHandlerAdapter}.</li> * </ul> * @param routerFunction the router function to convert * @param strategies the strategies to use * @return an http handler that handles HTTP request using the given router function */ public static HttpHandler toHttpHandler(RouterFunction<?> routerFunction, HandlerStrategies strategies) { WebHandler webHandler = toWebHandler(routerFunction, strategies); return WebHttpHandlerBuilder.webHandler(webHandler) .filters(filters -> filters.addAll(strategies.webFilters())) .exceptionHandlers(handlers -> handlers.addAll(strategies.exceptionHandlers())) .localeContextResolver(strategies.localeContextResolver()) .build(); }
.orderedStream() .collect(Collectors.toList()); builder.exceptionHandlers(handlers -> handlers.addAll(exceptionHandlers));
context.getAutowireCapableBeanFactory().autowireBean(container); builder.filters(filters -> filters.addAll(container.getFilters())); builder.exceptionHandlers(handlers -> handlers.addAll(container.getExceptionHandlers()));
@Override protected WebHttpHandlerBuilder initHttpHandlerBuilder() { WebHandler webHandler = RouterFunctions.toWebHandler(this.routerFunction, this.handlerStrategies); return WebHttpHandlerBuilder.webHandler(webHandler) .filters(filters -> filters.addAll(this.handlerStrategies.webFilters())) .exceptionHandlers(handlers -> handlers.addAll(this.handlerStrategies.exceptionHandlers())) .localeContextResolver(this.handlerStrategies.localeContextResolver()); }
.orderedStream() .collect(Collectors.toList()); builder.exceptionHandlers(handlers -> handlers.addAll(exceptionHandlers));