]> source.dussan.org Git - vaadin-framework.git/commitdiff
Made session reinitializing work again (#10411) 29/429/1
authorArtur Signell <artur@vaadin.com>
Thu, 29 Nov 2012 16:28:14 +0000 (18:28 +0200)
committerArtur Signell <artur@vaadin.com>
Thu, 29 Nov 2012 16:28:14 +0000 (18:28 +0200)
Change-Id: I012a5154fa3cf0bba6f3289213744b740cf12059

server/src/com/vaadin/server/VaadinService.java
server/src/com/vaadin/server/VaadinSession.java
uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.html

index 5338ec217bae0ddb8a556667014ff1fdf0628329..6794be4dbdcb32b8c1eabdc31b7b3ccd64df2b8e 100644 (file)
@@ -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
index 4aa2ef5d92d1ec945b02fdc4d1ddfc3db986727e..18db4127f4fecdcf3331cbdfeb809e419b663f29 100644 (file)
@@ -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()) {
index 6d028f1feaf5944e6c81b1e2c82f244b92b9183b..6bf4041a93d3cba0ee7ec7aef7d2b98f09e4e1cc 100644 (file)
        <td>/run/com.vaadin.tests.applicationcontext.ChangeSessionId?restartApplication</td>
        <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>
 </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>