I have a problem with ?restartApplication URL command (probably AbstractApplicationServlet.closeApplication method respectively) and Application.close() method as these methods are not invalidating sessions but only unregistering Vaadin Application from it. This works for Applications instances, but it keeps Spring session scoped beans in chaos - because HttpSession is left intact, Spring beans are not recreated but reused.
How can we solve this? I don’t know if there is a simple way how to invalidate all session scoped Spring beans in an application context, maybe just invalidating HttpSession would be simplier?
The logout() method is doable but it would be nice to be able to use the ?restartApplication and/or ?closeApplication.
There should be a hook to support closing a session (or not if desired) on close/restart. I tried to invalidate the session on Application.close() and on AbstractApplicationServlet.getNewApplicationand both result in internal vaadin failures similar to what is described above because it expects the session to be valid.
From Vaadin 6.7.6
private void closeApplication(Application application, HttpSession session) {
if (application == null) {
return;
}
application.close(); <- invalidating session here cause problems ahead
if (session != null) {
WebApplicationContext context = getApplicationContext(session);
context.removeApplication(application);
}
}
Here’s what happens when invaliding session on AbstractApplicationServlet.getNewApplicationand
11:50:58,072 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web]
.[default-host]
.
[/textura.test].[com.textura.web.p
qm.PqmApplication$Servlet]] (http--127.0.0.1-8080-3) Servlet.service() for servlet com.textura.web.pqm.PqmApplication$Se
rvlet threw exception: java.lang.NullPointerException
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.getExistingApplication(AbstractApplicationServlet.j
ava:2220) [vaadin-6.7.6.jar:6.7.6]
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.
java:769) [vaadin-6.7.6.jar:6.7.6]
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:456) [vaadi
n-6.7.6.jar:6.7.6]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.