?restartApplication issue

Hi,

How can I use Vaadin without being compelled to add “?restartApplication” to the URL (in order to avoid using the cache)?

Regards.

If you need to use ?restartApplication it usually means that you are using Vaadin in a way that wasn’t intended; how is you application built, and why do you want to reload all the time?

My application is one java file with one Application class that contains one window with some components and an OpenLayersMap. The latest updates on the java file aren’t downloaded when the page is refreshed in the browser.

So, you are developing your application and want to see the changes you make to you application with just a refresh?

Since Java is more complicated than e.g. PHP, this requires dynamic hot swap of in memory classes; JRebel is what you are looking for. Most servlet containers (Tomcat for example) are able to hot swap modified classes into the Java runtime, but not modify existing objects of that class. JRebel can do that as well. With JRebel, you don’t lose application state when doing a browser refresh, but most changes that you do to you classes should work fine.

JRebel is also included in the Vaadin Pro account, just FYI :slight_smile:

/Thomas

Well, not just with a refresh.
After changes are made in the sources, I run the application on the server (Tomcat and I’m using Eclipse). And then comes a refresh (after deleting browser cache).
Running the application on Tomcat and deleting browser cache should be sufficient to get the up to date application pages. Isn’t it?

No, that’s not how Vaadin works; it tracks HTTP session with cookies, which typically aren’t cleared alongside the cache. Clearing cookies would have the same effect as using restartApplication, except that the old session wouldn’t be closed immediately.

The Vaadin application state is stored in the HTTP session on the server side, clearing the browser cache has no effect on this. As long as the browser can be identified (by the session cookie), it will be served the exact same application state that it had last time. This means the same exact Java Object of your Application class.

There’s a cheaper option to enable an automatic redeployment of a Vaadin web application during development than using JRebel. This option is not as powerful as using JRebel, of course, but it works quite well nevertheless (and it’s for free :wink: ). If you don’t mind to use Maven as your build tool, you can follow the instructions described in my blog post at
blog.oio.de
to get an instant reloading of your Vaadin app while developing. You’ll find an example Maven project on
Github
.

Thanks guys ::thumbs up::