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 2020/10/20 20:10:12 UTC
[wicket] branch master updated (ad2dcd6 -> d929d85)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git.
from ad2dcd6 WICKET-6844 Add support for MethodMismatchResponse for Ajax behaviors
new 8664176 WICKET-6845 stackoverflow while serializing a page containing a reference to session
new d929d85 WICKET-6845 stackoverflow while serializing a page containing a reference to session
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../wicket/pageStore/InSessionPageStore.java | 7 +++--
.../apache/wicket/pageStore/RequestPageStore.java | 32 ++++++++++++++--------
2 files changed, 24 insertions(+), 15 deletions(-)
[wicket] 02/02: WICKET-6845 stackoverflow while serializing a page
containing a reference to session
Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit d929d852e75567e32a2864674b821900c4929eed
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Oct 20 23:08:19 2020 +0300
WICKET-6845 stackoverflow while serializing a page containing a reference to session
Remove the page from InSessionPageStore#pages before trying to serialize it to prevent stackoverflow when the page keeps a reference to the Wicket Session.
---
.../main/java/org/apache/wicket/pageStore/InSessionPageStore.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java
index a1beb4d..87cb701 100644
--- a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java
+++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java
@@ -278,15 +278,16 @@ public class InSessionPageStore implements IPageStore
if ((page instanceof SerializedPage) == false)
{
+ pages.remove(p);
if (serializer == null)
{
- pages.remove(p);
p--;
}
else
{
- pages.set(p, new SerializedPage(page.getPageId(),
- Classes.name(page.getClass()), serializer.serialize(page)));
+ byte[] bytes = serializer.serialize(page);
+ SerializedPage serializedPage = new SerializedPage(page.getPageId(), Classes.name(page.getClass()), bytes);
+ pages.add(p, serializedPage);
}
}
}
[wicket] 01/02: WICKET-6845 stackoverflow while serializing a page
containing a reference to session
Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit 8664176abcc6393c54b29d058c655d440500bc8d
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Oct 20 23:07:30 2020 +0300
WICKET-6845 stackoverflow while serializing a page containing a reference to session
Make sure an HTTP session is created before committing the response.
This is needed because org.apache.wicket.pageStore.RequestPageStore#detach() is called after committing the response and it is too late to create an HTTP session at that time.
---
.../apache/wicket/pageStore/RequestPageStore.java | 32 ++++++++++++++--------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/RequestPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/RequestPageStore.java
index ddeab95..54dc9da 100644
--- a/wicket-core/src/main/java/org/apache/wicket/pageStore/RequestPageStore.java
+++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/RequestPageStore.java
@@ -59,6 +59,11 @@ public class RequestPageStore extends DelegatingPageStore
@Override
public void addPage(IPageContext context, IManageablePage page)
{
+ // make sure an HTTP session is bound before committing the response
+ if (isPageStateless(page) == false)
+ {
+ context.getSessionId(true);
+ }
getRequestData(context).add(page);
}
@@ -92,18 +97,7 @@ public class RequestPageStore extends DelegatingPageStore
RequestData requestData = getRequestData(context);
for (IManageablePage page : requestData.pages())
{
- boolean isPageStateless;
- try
- {
- isPageStateless = page.isPageStateless();
- }
- catch (Exception x)
- {
- log.warn("An error occurred while checking whether a page is stateless. Assuming it is stateful.", x);
- isPageStateless = false;
- }
-
- if (isPageStateless == false)
+ if (isPageStateless(page) == false)
{
getDelegate().addPage(context, page);
}
@@ -113,6 +107,20 @@ public class RequestPageStore extends DelegatingPageStore
getDelegate().detach(context);
}
+ private boolean isPageStateless(final IManageablePage page) {
+ boolean isPageStateless;
+ try
+ {
+ isPageStateless = page.isPageStateless();
+ }
+ catch (Exception x)
+ {
+ log.warn("An error occurred while checking whether a page is stateless. Assuming it is stateful.", x);
+ isPageStateless = false;
+ }
+ return isPageStateless;
+ }
+
private RequestData getRequestData(IPageContext context)
{
return context.getRequestData(KEY, RequestData::new);