Is it possible to add 2 handlers for a path?
I need to load html
contents from a folder and check session
values when i access /
path.
If i place router.route().handler(StaticHandler.create().setWebRoot("webroot"));
it will read contents from webroot
folder.
And when i use the following code, It will execute the hanlder code.
router.route("/").handler(routingContext -> {
Session session = routingContext.session();
String name = session.get("uname");
// some code
});
But is there any way to execute both handlers when i try to access this path?
I tried
HttpServerResponse response = routingContext.response();
response.sendFile("webroot/index.html");
But it just read the index.html
file and it doesn't read CSS. And I couldn't find a method to read the entire directory.