Closed yale8848 closed 6 years ago
Could you provide a little more detail about what you are trying to achieve?
We can use session in Vertx-Web like this:
SessionStore store = LocalSessionStore.create(vertx);
SessionHandler sessionHandler = SessionHandler.create(store)
router.route().handler(sessionHandler);
So my question is how do this in vertx-jersey?
We can use templates in Vertx-Web like this:
TemplateEngine engine = ThymeleafTemplateEngine.create();
TemplateHandler handler = TemplateHandler.create(engine);
router.getWithRegex(".+\\.hbs").handler(handler);
So how do this in vertx-jersey?
I hope you can give me some example. Thanks very much.
Ok, I understand what you are asking about.
vertx-web
and vertx-jersey
are not exactly equivalent. The intention of vertx-jersey
is to allow you to work with standard JAX-RS resources with vert.x acting as the container rather than the traditional HttpServlet
(Jetty, Tomcat, etc.).
Jersey is typically used in a stateless way, session management is delegated to the container. In theory you could try to use the vertx-web
SessionStore with Jersey, but you would need to recreate the SessionHandlerImpl functionality to work with HttpServerRequest
rather than RoutingContext
in a JAX-RS ContainerRequestFilter
.
For templating, try searching for JAX-RS template
and you should find plenty of examples. Here is someone using mustache.
Hope this helps.
Get it. Thanks you very much. 👍
Could you give some example with how to deal session and templates? Thanks very much!