Hello ,
We are developing a web application using Vertx. On click of button on the html page(developed using thymeleaf) the page is submitted to a url (/action/dosomething) , this call is handled by one of the handlers configured in vertx vertical.
router.route("/action/*").handler(this::handlePageAction);
handlePageAction method acts as a controller and determines which html page to call next based on some conditions. For forwarding the request to next html page this is the code we are using:
routingContext.response().putHeader("location", "/view/"+htmlPageName).setStatusCode(302).end();
I have another handler in same vertical which takes care of rendering the html page requested using ThymeleafTemplateHandler
router.route("/view/*").handler(templateHandler);
I need to display some dynamic data in the requested html page and need to set that data in routing context which i can then access in thymeleaf. But problem I am facing is that any data i set in routing context before calling routingContext.response().putHeader("location",xyz) is getting lost. I read in the documentation that routingContext is only available till the response is written.
I have 2 questions here
1. Is these any other way of forwarding requests in vertx which also allows me to pass parameters in the request?
2. Is there any other mechanism of passing data between multiple requests(apart from using sessions)
Will appreciate any pointers/help on this. Thanks !