提交 1c9d4deb 编写于 作者: R Rossen Stoyanchev

Add methods to prepend WebFilter + WebExceptionHandler

上级 2cd6240d
......@@ -131,7 +131,7 @@ public class WebHttpHandlerBuilder {
/**
* Add the given filters to use for processing requests.
* Add the given filters.
* @param filters the filters to add
*/
public WebHttpHandlerBuilder filters(List<? extends WebFilter> filters) {
......@@ -142,7 +142,17 @@ public class WebHttpHandlerBuilder {
}
/**
* Add the given exception handler to apply at the end of request processing.
* Insert the given filter before other configured filters.
* @param filter the filters to insert
*/
public WebHttpHandlerBuilder prependFilter(WebFilter filter) {
Assert.notNull(filter, "WebFilter is required");
this.filters.add(0, filter);
return this;
}
/**
* Add the given exception handlers.
* @param handlers the exception handlers
*/
public WebHttpHandlerBuilder exceptionHandlers(List<WebExceptionHandler> handlers) {
......@@ -152,6 +162,16 @@ public class WebHttpHandlerBuilder {
return this;
}
/**
* Insert the given exception handler before other configured handlers.
* @param handler the exception handler to insert
*/
public WebHttpHandlerBuilder prependExceptionHandler(WebExceptionHandler handler) {
Assert.notNull(handler, "WebExceptionHandler is required");
this.exceptionHandlers.add(0, handler);
return this;
}
/**
* Configure the {@link WebSessionManager} to set on the
* {@link ServerWebExchange WebServerExchange}.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册