Details
Description
Hi.
The removed page might revive.
This is caused in the following conditions:
1) "getPageMap().remove(this)" or "getPageMap().remove()" on onXXX() handler. (e.g. Link#onClick())
2) Screen transition using "setResponsePage(NextPage.class)".
3) Push back-button on NextPage.
4) The removed page revive.
This cause is as follows:
a) When NextPage is displayed, the removed page remains in "org.apache.wicket.protocol.http.SecondLevelCacheSessionStore.SecondLevelCachePageMap.lastPage".
b) When the removed page is re-displayed by back-button, SecondLevelCachePageMap.get(int, int) revive the page by lastPage.
The problem doesn't happen when use "setResponsePage(new NextPage())" instead of "setResponsePage(NextPage.class)".
Because "lastPage" is overwritten by the instance of NextPage.
It is my patch as follows:
Index: src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
===================================================================
— src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java (revision 930858)
+++ src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java (working copy)
@@ -348,6 +348,7 @@
+ lastPage = null;
}
/**
@@ -361,6 +362,9 @@
+ if (lastPage instanceof Page && ((Page) lastPage).getPageMapEntry() == entry)
{ + lastPage = null; + }}
private IPageStore getStore()