diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-11-30 07:47:20 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-30 07:47:20 +0000 |
commit | 8dd5a84f508956c17e9f4da21c178cc7987abd9e (patch) | |
tree | 3e72ca894d443b214b6a84e5186c62a0a1d15272 | |
parent | 9dd665b56eb4166d2af92a4825c37d20d15ed413 (diff) | |
parent | c2b7aad4b62be9c807cd3c08f0c3d6ad72f4f1c6 (diff) | |
download | vaadin-framework-8dd5a84f508956c17e9f4da21c178cc7987abd9e.tar.gz vaadin-framework-8dd5a84f508956c17e9f4da21c178cc7987abd9e.zip |
Merge "Made session reinitializing work again (#10411)"
-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> |