Vaadin 7 and embedded jetty

I’m trying to set up a clojure environment for vaadin 7. With vaadin6 I could use AbstractApplicationServlet which provides the application class. I can then do in clojure repl '(use ‘foo.bar.core :reload) (restart)’ to reload the servlet immediately (without waiting for recompiling / repackaging / waiting for jvm to start).

I am now trying to do the same with Vaadin 7. The migration guide in
Vaadin 6 to 7
mentions that AbstractApplicationServlet has been replaced by VaadinServlet. VaadinServlet however does not provide similar hooks to provide the default UI class. How can I use an embedded jetty with vaadin 7?

Use a custom UIProvider - see e.g.
this tutorial
.

Sorry, I don’t see how this is any different than providing the UI class in the web.xml file? Instead of providing the UI class, you provide the UIProvider class. At least I can’t immediately see how this allows providing a proper servlet for embedded jetty.

I’m not sure if I understand exactly what you need or mean by a proper servlet, then, and what is needed for the reloading to work the way you want.

There should be no problem in using VaadinServlet in an embedded Jetty.

Using a slightly customized UIProvider is very similar to using AbstractApplicationServlet in Vaadin 6 and implementing/overriding selected methods related to constructing an Application, just more flexible. Your custom UI provider can return either a UI class or directly an instance of a UI that you construct (or reuse) in whatever way you want. You might even be able to use VaadinSession.addUI(ui) to add a pre-initialized UI if that is what you want, although doing it via a UIProvider is probably a better alternative.

You can also register multiple custom UIProviders in code if you want, switch them at runtime and more by calling VaadinSession.addUIProvider(…) etc.

Thank you. I haven’t tested this yet, just checked the API. If I understood correctly, I can create the VaadinServlet, then call the static method VaadinSession::getCurrent() which gives me the session. With this session I can either addUIProvider or addUI. Did I understand correctly? But then again, the documentation for VaadinSession lets me think that the session is only for the current session…?