[ 
https://issues.apache.org/jira/browse/WICKET-2130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677005#action_12677005
 ] 

Martijn Dashorst commented on WICKET-2130:
------------------------------------------

Patch below fixes the unit test, but causes multiple detaches for normal pages. 
I'd suggest setting the ATTACHED flag in the Page constructor. Typically a page 
is constructed in an Attached state, but might not be rendered until a next 
request (and only then pass through onAttach()).

Index: src/main/java/org/apache/wicket/Session.java
===================================================================
--- src/main/java/org/apache/wicket/Session.java        (revision 746413)
+++ src/main/java/org/apache/wicket/Session.java        (working copy)
@@ -57,11 +57,10 @@
  * holds the Page. So {...@link Component#getSession()} traverses the 
component hierarchy to the root
  * Page and then calls {...@link Page#getSession()}.
  * 
- * <li><b>Access via Thread Local </b>- In the odd case where neither a 
RequestCycle nor a
- * Component is available, the currently active Session for the calling thread 
can be retrieved by
- * calling the static method Session.get(). This last form should only be used 
if the first two
- * forms cannot be used since thread local access can involve a potentially 
more expensive hash map
- * lookup.
+ * <li><b>Access via Thread Local </b>- In the odd case where neither a 
RequestCycle nor a Component
+ * is available, the currently active Session for the calling thread can be 
retrieved by calling the
+ * static method Session.get(). This last form should only be used if the 
first two forms cannot be
+ * used since thread local access can involve a potentially more expensive 
hash map lookup.
  * 
  * <li><b>Locale </b>- A session has a Locale property to support 
localization. The Locale for a
  * session can be set by calling {...@link Session#setLocale(Locale)}. The 
Locale for a Session
@@ -103,9 +102,9 @@
  * <li><b>Removal </b>- Pages can be removed from the Session forcibly by 
calling remove(Page) or
  * removeAll(), although such an action should rarely be necessary.
  * 
- * <li><b>Flash Messages</b>- Flash messages are messages that are stored in 
session and are
- * removed after they are displayed to the user. Session acts as a store for 
these messages because
- * they can last across requests.
+ * <li><b>Flash Messages</b>- Flash messages are messages that are stored in 
session and are removed
+ * after they are displayed to the user. Session acts as a store for these 
messages because they can
+ * last across requests.
  * 
  * @author Jonathan Locke
  * @author Eelco Hillenius
@@ -388,8 +387,8 @@
         * <p>
         * By calling this method, the session will be bound (made 
not-temporary) if it was not bound
         * yet. It is useful for cases where you want to be absolutely sure 
this session object will be
-        * available in next requests. If the session was already bound 
({...@link ISessionStore#lookup(Request) returns a session}),
-        * this call will be a noop.
+        * available in next requests. If the session was already bound (
+        * {...@link ISessionStore#lookup(Request) returns a session}), this 
call will be a noop.
         * </p>
         */
        public final void bind()
@@ -1367,6 +1366,9 @@
                        for (int i = 0; i < touchedPages.size(); i++)
                        {
                                Page page = (Page)touchedPages.get(i);
+
+                               // ensure pages are detached when shared 
through the pagemaps
+                               page.detach();
                                page.getPageMap().put(page);
                                dirty = true;
                        }


> Pages stored in Session.touchedPages aren't detached when part of ModalWindow
> -----------------------------------------------------------------------------
>
>                 Key: WICKET-2130
>                 URL: https://issues.apache.org/jira/browse/WICKET-2130
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5, 1.4-RC2
>            Reporter: Martijn Dashorst
>             Fix For: 1.3.6, 1.4-RC3
>
>         Attachments: wicket-2130.tgz
>
>
> Creating a ModalWindow with a Page causes the newly constructed page not to 
> be detached.
> The page is stored in Session.touchedPages, but that list isn't properly 
> processed at the end of the request for detaching.
> I'll try to create a testcase for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to