You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2017/06/04 20:49:21 UTC
wicket git commit: WICKET-6387 ModalWindow PageReference broken
Repository: wicket
Updated Branches:
refs/heads/wicket-7.x 837b6b147 -> 95fcc140d
WICKET-6387 ModalWindow PageReference broken
Do not remove the session data when the SessionEntry is updated in the Session
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/95fcc140
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/95fcc140
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/95fcc140
Branch: refs/heads/wicket-7.x
Commit: 95fcc140dc64b8226f54664b70249ec3067e0768
Parents: 837b6b1
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Jun 4 22:48:20 2017 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Jun 4 22:48:20 2017 +0200
----------------------------------------------------------------------
.../org/apache/wicket/page/PageStoreManager.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/95fcc140/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java b/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
index 58ec8d3..b3fef89 100644
--- a/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
+++ b/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
@@ -94,6 +95,16 @@ public class PageStoreManager extends AbstractPageManager
private transient List<Object> afterReadObject;
/**
+ * A flag indicating whether this session entry has been re-set in the Session.
+ * Web containers intercept {@link javax.servlet.http.HttpSession#setAttribute(String, Object)}
+ * to detect changes and replicate the session. If the attribute has been already
+ * bound in the session then it will be first unbound and then re-bound again.
+ * This flag helps us to detect <em>update</em> operations and skip the default behavior
+ * of {@link #valueUnbound(HttpSessionBindingEvent)}.
+ */
+ private final AtomicBoolean updating = new AtomicBoolean(false);
+
+ /**
* Construct.
*
* @param applicationName
@@ -311,6 +322,12 @@ public class PageStoreManager extends AbstractPageManager
@Override
public void valueUnbound(HttpSessionBindingEvent event)
{
+ if (updating.compareAndSet(true, false))
+ {
+ // The entry has been updated. Do not remove the data
+ return;
+ }
+
// WICKET-5164 use the original sessionId
IPageStore store = getPageStore();
// store might be null if destroyed already
@@ -410,6 +427,7 @@ public class PageStoreManager extends AbstractPageManager
// WICKET-5103 use the same sessionId as used in SessionEntry#getPage()
pageStore.storePage(entry.sessionId, page);
}
+ entry.updating.set(true);
setSessionAttribute(getAttributeName(), entry);
}
}