You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2020/08/05 21:48:35 UTC

[wicket] branch master updated: WICKET-6810 fix asynchronous encryption

This is an automated email from the ASF dual-hosted git repository.

svenmeier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new c26f3dc  WICKET-6810 fix asynchronous encryption
c26f3dc is described below

commit c26f3dc315dfdae9e51e7fdb97c13113d6845073
Author: Sven Meier <sv...@apache.org>
AuthorDate: Wed Aug 5 23:35:59 2020 +0200

    WICKET-6810 fix asynchronous encryption
---
 .../org/apache/wicket/pageStore/AsynchronousPageStore.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java
index fd55e40..cc29efd 100644
--- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java
+++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java
@@ -135,6 +135,12 @@ public class AsynchronousPageStore extends DelegatingPageStore
 		 */
 		private final Map<String, Serializable> attributeCache = new HashMap<>();
 
+		/**
+		 * Cache of session data which may filled in {@link IPageStore#canBeAsynchronous(IPageContext)},
+		 * so these are available asynchronously later on.
+		 */
+		private final Map<MetaDataKey<?>, Serializable> dataCache = new HashMap<>();
+
 		public PendingAdd(final IPageContext context, final IManageablePage page)
 		{
 			this.context = Args.notNull(context, "context");
@@ -211,15 +217,19 @@ public class AsynchronousPageStore extends DelegatingPageStore
 			
 			if (asynchronous)
 			{
-				value = context.getSessionData(key, () -> null);
+				value = (T)dataCache.get(key);
 				if (value == null && defaultValue.get() != null)
 				{
-						throw new WicketRuntimeException("session data can not be changed asynchronuously");
+					throw new WicketRuntimeException("session data can not be changed asynchronuously");
 				}
 			}
 			else
 			{
 				value = context.getSessionData(key, defaultValue);
+				if (value != null)
+				{
+					dataCache.put(key, value);
+				}
 			}
 			
 			return value;