aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/com/vaadin/server/VaadinSession.java4
-rw-r--r--server/src/test/java/com/vaadin/ui/UITest.java17
2 files changed, 21 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java
index a49c286f4a..d3da73d993 100644
--- a/server/src/main/java/com/vaadin/server/VaadinSession.java
+++ b/server/src/main/java/com/vaadin/server/VaadinSession.java
@@ -1035,6 +1035,10 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
+ ui.getUIId(),
e);
}
+ // Store session after modifications have been done so that
+ // Spring Session and possibly other implementations realize
+ // that something has changed inside the session attribute
+ service.storeSession(this, session);
}
}
} finally {
diff --git a/server/src/test/java/com/vaadin/ui/UITest.java b/server/src/test/java/com/vaadin/ui/UITest.java
index 8bc3c98470..f2fcdcb055 100644
--- a/server/src/test/java/com/vaadin/ui/UITest.java
+++ b/server/src/test/java/com/vaadin/ui/UITest.java
@@ -8,7 +8,9 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpSession;
+import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -20,6 +22,7 @@ import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.server.VaadinServletService;
import com.vaadin.server.VaadinSession;
+import com.vaadin.server.WrappedHttpSession;
import com.vaadin.server.communication.PushConnection;
import com.vaadin.shared.communication.PushMode;
import com.vaadin.util.CurrentInstanceTest;
@@ -175,7 +178,21 @@ public class UITest {
VaadinServletService service = new VaadinServletService(servlet,
deploymentConfiguration);
MockVaadinSession session = new MockVaadinSession(service);
+ HttpSession mockHttpSession = EasyMock.createMock(HttpSession.class);
+ WrappedHttpSession mockWrappedSession = new WrappedHttpSession(
+ mockHttpSession) {
+ @Override
+ public Object getAttribute(String name) {
+ String lockAttribute = service.getServiceName() + ".lock";
+ if (lockAttribute.equals(name)) {
+ return session.getLockInstance();
+ } else {
+ return super.getAttribute(name);
+ }
+ }
+ };
session.lock();
+ session.refreshTransients(mockWrappedSession, service);
ui.setSession(session);
ui.doInit(Mockito.mock(VaadinRequest.class), 1, "foo");
session.addUI(ui);