Swing application to Vaadin: Browser connects later?

Hello all,
I want an existing application implemented in Swing to migrate to html5 UI, possibly (hopefully) using Vaadin.
The Swing application is started from the command line or start menu and displays the status of connected hardware,
e.g. scale, printer, …
My idea is: From that application, start an embedded tomcat and deploy the vaadim webapp.
Now my question: Is it possible to start it this way, instantiating graphical components without a browser is connected?
I want to show the “current status” if a browser (or multiple) connects.
As far as I have read the design is always that a browser request instantiates the UI object,
but this would be too late since some hardware status change could cause adding or removing view components.
Any comments are highly appreciated.

I’d think there rather many ways to solve that issue.

I’d first consider a device service that runs independently of the Vaadin app. It would monitor the device status and send the status information to the Vaadin application through a servlet running in the same application (WAR). The UIs could then fetch data collected by the servlet or, if you use push, the collector servlet could send the data to registered UIs. I’ve had such a collector service implemented in
a Vaadin app for another purpose
(in Scala), but the idea would be similar.

You should also be able to execute code when the Vaadin servlet is deployed. I’m not immediately sure what different solutions there are… The VaadinServlet is instantiated on the first request, so its initialization would be too late for that as well. One way is to have initialization code in static blocks in Java classes, as they are executed when the classes are loaded, which with Vaadin apps is done when they are deployed; I think the above mentioned Scala app uses that solution in the ProbeData singleton. I don’t know if there’s any problems with that, but anyhow. Another way would be to use a ServletContextListener, but I haven’t tried that so can’t help you with that; you can probably find info by googling about it and Vaadin.