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:51:33 UTC
[1/2] wicket git commit: WICKET-6387 ModalWindow PageReference broken
Repository: wicket
Updated Branches:
refs/heads/master 1cec46206 -> 11df645ad
WICKET-6387 ModalWindow PageReference broken
Do not remove the session data when the SessionEntry is updated in the Session
(cherry picked from commit 95fcc140dc64b8226f54664b70249ec3067e0768)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9e50533f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9e50533f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9e50533f
Branch: refs/heads/master
Commit: 9e50533f2d9546d46686a88146936b25e1f355dd
Parents: 1cec462
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:49:51 2017 +0200
----------------------------------------------------------------------
.../org/apache/wicket/page/PageStoreManager.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/9e50533f/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 9a175f9..df956cc 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
@@ -324,6 +335,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
@@ -432,6 +449,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);
}
}
[2/2] wicket git commit: Non-functional changes
Posted by mg...@apache.org.
Non-functional changes
Java 7 diamonds and removal of unnecessary 'if'
(cherry picked from commit daecdc6c40076855288ab551741bb56f36c331c6)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/11df645a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/11df645a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/11df645a
Branch: refs/heads/master
Commit: 11df645ad6fdd54c2231099b83583b6b096c2cb0
Parents: 9e50533
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Jun 4 22:49:58 2017 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Jun 4 22:51:22 2017 +0200
----------------------------------------------------------------------
.../main/java/org/apache/wicket/pageStore/DiskDataStore.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/11df645a/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskDataStore.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskDataStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskDataStore.java
index c91890c..2dd95e4 100644
--- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskDataStore.java
+++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskDataStore.java
@@ -181,10 +181,7 @@ public class DiskDataStore implements IDataStore
SessionEntry sessionEntry = getSessionEntry(sessionId, true);
if (sessionEntry != null)
{
- if (log.isDebugEnabled())
- {
- log.debug("Storing data for page with id '{}' in session with id '{}'", id, sessionId);
- }
+ log.debug("Storing data for page with id '{}' in session with id '{}'", id, sessionId);
sessionEntry.savePage(id, data);
}
}
@@ -262,8 +259,7 @@ public class DiskDataStore implements IDataStore
ObjectOutputStream oos = new ObjectOutputStream(stream);
try
{
- Map<String, SessionEntry> map = new HashMap<String, SessionEntry>(
- sessionEntryMap.size());
+ Map<String, SessionEntry> map = new HashMap<>(sessionEntryMap.size());
for (Entry<String, SessionEntry> e : sessionEntryMap.entrySet())
{
if (e.getValue().unbound == false)