Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
I've just been reading about the proposals for a Vaadin stateless mode here: http://vaadin.com/forum/-/message_boards/view_message/296574
Im looking for something similar, but not quite. What I want is a mode that will cause Vaadin to immediately forget any state, and close the users instance of that application as soon as the user leaves the page, either by navigating away, or indeed just refreshing. Also, if I connect to the same application, using a second browser window, I want to have 2 instances of my application running independently in both of the windows.
If, lets say I decide to navigate elsewhere, and the press back button, the application should appear as if its the first time it is run, rather than showing the previous state....
This gives a few advantages.
1) Get rid of the 'out of sync' messages, when the user launches a second window to interact with my app. Yes, I know it is possible by overriding getWindow() in Application... But the new windows only get garbage collected when the whole app closes, causing a memory leak, especially if the user hits refresh on the browser often.
2) Browser Refresh works!! - Yes, it will cause the screen to reload, and 'flicker'.... but, at the moment, the data values on screen are not refreshed; Vaadin just passes back the last known state to the browser, without actually pinging any of my applications code to update the data first.
3) My application can link to different parts of the app, by propper html links, including forward slashes, and not having to use html fragments which don't work when the app is inside an iFrame. When a user clicks, the current instance of the applicartion is closed, the link is followed, and a new Vaadin application is started. As part of initialisation, the followed link can be queried, and the correct view be shown to the user.
I fully understand, that this will cause the application to 'flicker' when the user navigates around. However, once settled on a page, the user will be able to interact in the same vaddin sweetness as is current..... but, the advantages are it would work more like a traditional web app.
Would this be difficult to do?
Don't know about all the different cases you have, but at least programmatically you can "restart" the application by calling Application.close(). This will start a completely fresh session. Also, from the users standpoint adding ?restartApplication to the end of the url will do the same as close(). Maybe you could leverage that into forcing refreshes into restarting the app. There are also a bunch of transaction listeners where you could decide when you should close the app to make room for a new one. Look more about them from the ThreadLocal wiki article.