summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-09-25 18:27:53 +0300
committerVaadin Code Review <review@vaadin.com>2015-09-29 08:00:06 +0000
commitca38846dff92c8c8e4cd971106b2c65dae0463c1 (patch)
tree8161b7c988dff9bf7134339ee08a9990e1768a3c
parentd27652c54ec99c6500c05a984eaa8c168ae1a7af (diff)
downloadvaadin-framework-ca38846dff92c8c8e4cd971106b2c65dae0463c1.tar.gz
vaadin-framework-ca38846dff92c8c8e4cd971106b2c65dae0463c1.zip
Store VaadinSession as APPLICATION_SCOPE in portals (#18998)
Change-Id: I729cba0844e54ca2fab2c9b26ab5ea5fc0c4ca1c
-rw-r--r--server/src/com/vaadin/server/VaadinPortletSession.java11
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java12
2 files changed, 20 insertions, 3 deletions
diff --git a/server/src/com/vaadin/server/VaadinPortletSession.java b/server/src/com/vaadin/server/VaadinPortletSession.java
index 23b578cea2..512e91a82f 100644
--- a/server/src/com/vaadin/server/VaadinPortletSession.java
+++ b/server/src/com/vaadin/server/VaadinPortletSession.java
@@ -316,4 +316,15 @@ public class VaadinPortletSession extends VaadinSession {
"Portlet mode can only be changed from a portlet request");
}
}
+
+ @Override
+ public void storeInSession(VaadinService service, WrappedSession session) {
+ assert hasLock(service, session);
+ ((WrappedPortletSession) session).setAttribute(
+ getSessionAttributeName(service), this,
+ PortletSession.APPLICATION_SCOPE);
+
+ refreshLock();
+ }
+
}
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index e5d63a6961..8706cd0821 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -504,8 +504,9 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* @param service
* The service associated with the sessio
* @return The attribute name used for storing the session
+ * @since
*/
- private static String getSessionAttributeName(VaadinService service) {
+ protected static String getSessionAttributeName(VaadinService service) {
return VaadinSession.class.getName() + "." + service.getServiceName();
}
@@ -536,8 +537,10 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
/**
* Updates the transient session lock from VaadinService.
+ *
+ * @since
*/
- private void refreshLock() {
+ protected void refreshLock() {
assert lock == null || lock == service.getSessionLock(session) : "Cannot change the lock from one instance to another";
assert hasLock(service, session);
lock = service.getSessionLock(session);
@@ -814,6 +817,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* Checks if the current thread has exclusive access to this VaadinSession
*
* @return true if the thread has exclusive access, false otherwise
+ * @since
*/
public boolean hasLock() {
ReentrantLock l = ((ReentrantLock) getLockInstance());
@@ -825,8 +829,10 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* WrappedSession.
*
* @return true if this thread has exclusive access, false otherwise
+ * @since
*/
- private static boolean hasLock(VaadinService service, WrappedSession session) {
+ protected static boolean hasLock(VaadinService service,
+ WrappedSession session) {
ReentrantLock l = (ReentrantLock) service.getSessionLock(session);
return l.isHeldByCurrentThread();
}