diff options
author | Artur Signell <artur@vaadin.com> | 2012-11-29 18:28:14 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-11-29 18:28:14 +0200 |
commit | c2b7aad4b62be9c807cd3c08f0c3d6ad72f4f1c6 (patch) | |
tree | 61db770f12b3b4f308c85b783acfb9e91dffeda5 | |
parent | cfb2513cd2049d6cae90b6d2c725a03e75194ce9 (diff) | |
download | vaadin-framework-c2b7aad4b62be9c807cd3c08f0c3d6ad72f4f1c6.tar.gz vaadin-framework-c2b7aad4b62be9c807cd3c08f0c3d6ad72f4f1c6.zip |
Made session reinitializing work again (#10411)
Change-Id: I012a5154fa3cf0bba6f3289213744b740cf12059
-rw-r--r-- | server/src/com/vaadin/server/VaadinService.java | 7 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinSession.java | 6 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.html | 15 |
3 files changed, 19 insertions, 9 deletions
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 5338ec217b..6794be4dbd 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -47,7 +47,7 @@ import com.vaadin.util.ReflectTools; * @since 7.0 */ public abstract class VaadinService implements Serializable { - private static final String REINITIALIZING_SESSION_MARKER = VaadinService.class + static final String REINITIALIZING_SESSION_MARKER = VaadinService.class .getName() + ".reinitializing"; private static final Method SESSION_INIT_METHOD = ReflectTools.findMethod( @@ -329,11 +329,6 @@ public abstract class VaadinService implements Serializable { } public void fireSessionDestroy(VaadinSession vaadinSession) { - // Ignore if the session is being moved to a different backing session - if (vaadinSession.getAttribute(REINITIALIZING_SESSION_MARKER) == Boolean.TRUE) { - return; - } - for (UI ui : new ArrayList<UI>(vaadinSession.getUIs())) { // close() called here for consistency so that it is always called // before a UI is removed. UI.isClosing() is thus always true in diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java index 4aa2ef5d92..18db4127f4 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -162,6 +162,12 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { + "This might happen if a session is deserialized but never used before it expires."); } else if (VaadinService.getCurrentRequest() != null && getCurrent() == this) { + // Ignore if the session is being moved to a different backing + // session + if (getAttribute(VaadinService.REINITIALIZING_SESSION_MARKER) == Boolean.TRUE) { + return; + } + // There is still a request in progress for this session. The // session will be destroyed after the response has been written. if (!isClosing()) { diff --git a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.html b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.html index 6d028f1fea..6bf4041a93 100644 --- a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.html +++ b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.html @@ -17,21 +17,30 @@ <td></td> </tr> <tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsapplicationcontextChangeSessionId::PID_SLog_row_0</td> + <td>1. Session id: *</td> +</tr> +<tr> <td>click</td> <td>vaadin=runcomvaadintestsapplicationcontextChangeSessionId::/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestsapplicationcontextChangeSessionId::PID_SLog_row_0</td> + <td>2. Session id changed successfully from * to *</td> +</tr> +<tr> <td>click</td> <td>vaadin=runcomvaadintestsapplicationcontextChangeSessionId::/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> <td></td> </tr> <tr> <td>assertText</td> - <td>vaadin=runcomvaadintestsapplicationcontextChangeSessionId::PID_SLog_row_1</td> - <td>2. Session id changed successfully from * to *</td> + <td>vaadin=runcomvaadintestsapplicationcontextChangeSessionId::PID_SLog_row_0</td> + <td>3. Session id: *</td> </tr> - </tbody></table> </body> </html> |