public class Filters extends Object
public void init(@Observes Filters filters) {
filters.register(rc -> {
// Do something before the next filter or route
rc.next();
// Do something after
}, 10);
}
The handler is the filter code. It must call RoutingContext.next() to invoke the next filter or route.
The priority is used to sort the filters. Highest priorities are called first.
| Modifier and Type | Class and Description |
|---|---|
static class |
Filters.SimpleFilter
Simple implementation of filter.
|
| Constructor and Description |
|---|
Filters() |
| Modifier and Type | Method and Description |
|---|---|
List<Filter> |
getFilters() |
Filters |
register(io.vertx.core.Handler<io.vertx.ext.web.RoutingContext> handler,
int priority)
Registers a new filter.
|
public Filters register(io.vertx.core.Handler<io.vertx.ext.web.RoutingContext> handler, int priority)
handler - the filter function, must not be nullpriority - the priority, must not be negativeCopyright © 2021 JBoss by Red Hat. All rights reserved.