I am new to Vert.X.
Does Vert.x have a built in facility for centralized filters? What I mean are the kind of filters that you would use on a J2EE application.
For instance, all pages have to go through the auth filter, or something like that.
Is there a standardized way to achieve this in Vert.x?
I know this question is quite old, but for those still looking for filter in Vertx 3, the solution is to use subRouter as a filter:
    // Your regular routes
    router.route("/").handler((ctx) -> {
        ctx.response().end("...");
    });
    // Have more routes here...
    Router filterRouter = Router.router(vertx);
    filterRouter.get().handler((ctx)->{
        // Do something smart
        // Forward to your actual router
        ctx.next();
    });
    filterRouter.mountSubRouter("/", router);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With