Author: knopp
Date: Wed Sep 12 02:52:52 2007
New Revision: 574871

URL: http://svn.apache.org/viewvc?rev=574871&view=rev
Log:
WICKET-942

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/PageWindowManager.java

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java?rev=574871&r1=574870&r2=574871&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java 
(original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java 
Wed Sep 12 02:52:52 2007
@@ -52,9 +52,9 @@
        private static final long serialVersionUID = 1L;
 
        /**
-        * Gets a page map for a page map name, automatically creating the page 
map
-        * if it does not exist. If you do not want the pagemap to be 
automatically
-        * created, you can call Session.pageMapForName(pageMapName, false).
+        * Gets a page map for a page map name, automatically creating the page 
map if it does not
+        * exist. If you do not want the pagemap to be automatically created, 
you can call
+        * Session.pageMapForName(pageMapName, false).
         * 
         * @param pageMapName
         *            The name of the page map to get
@@ -114,8 +114,7 @@
        }
 
        /**
-        * Redirects to any intercept page previously specified by a call to
-        * redirectToInterceptPage.
+        * Redirects to any intercept page previously specified by a call to 
redirectToInterceptPage.
         * 
         * @return True if an original destination was redirected to
         * @see PageMap#redirectToInterceptPage(Page)
@@ -214,11 +213,10 @@
        public abstract void put(final Page page);
 
        /**
-        * Redirects browser to an intermediate page such as a sign-in page. The
-        * current request's URL is saved exactly as it was requested for 
future use
-        * by continueToOriginalDestination(); Only use this method when you 
plan to
-        * continue to the current URL at some later time; otherwise just use
-        * setResponsePage or, when you are in a constructor, redirectTo.
+        * Redirects browser to an intermediate page such as a sign-in page. 
The current request's URL
+        * is saved exactly as it was requested for future use by 
continueToOriginalDestination(); Only
+        * use this method when you plan to continue to the current URL at some 
later time; otherwise
+        * just use setResponsePage or, when you are in a constructor, 
redirectTo.
         * 
         * @param pageClazz
         *            The page clazz to temporarily redirect to
@@ -231,11 +229,10 @@
        }
 
        /**
-        * Redirects browser to an intermediate page such as a sign-in page. The
-        * current request's URL is saved exactly as it was requested for 
future use
-        * by continueToOriginalDestination(); Only use this method when you 
plan to
-        * continue to the current URL at some later time; otherwise just use
-        * setResponsePage or, when you are in a constructor, redirectTo.
+        * Redirects browser to an intermediate page such as a sign-in page. 
The current request's URL
+        * is saved exactly as it was requested for future use by 
continueToOriginalDestination(); Only
+        * use this method when you plan to continue to the current URL at some 
later time; otherwise
+        * just use setResponsePage or, when you are in a constructor, 
redirectTo.
         * 
         * @param page
         *            The page to temporarily redirect to
@@ -285,6 +282,9 @@
        {
                // Remove the pagemap entry from session
                removeEntry(page.getPageMapEntry());
+
+               // Make sure it doesn't get added again at the end of the 
request cycle
+               Session.get().untouch(page);
        }
 
        /**
@@ -348,10 +348,9 @@
        private MetaDataEntry[] metaData;
 
        /**
-        * Sets the metadata for this PageMap using the given key. If the 
metadata
-        * object is not of the correct type for the metadata key, an
-        * IllegalArgumentException will be thrown. For information on creating
-        * MetaDataKeys, see [EMAIL PROTECTED] MetaDataKey}.
+        * Sets the metadata for this PageMap using the given key. If the 
metadata object is not of the
+        * correct type for the metadata key, an IllegalArgumentException will 
be thrown. For
+        * information on creating MetaDataKeys, see [EMAIL PROTECTED] 
MetaDataKey}.
         * 
         * @param key
         *            The singleton key for the metadata

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java?rev=574871&r1=574870&r2=574871&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java 
(original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java 
Wed Sep 12 02:52:52 2007
@@ -1097,6 +1097,22 @@
        }
 
        /**
+        * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
+        * <p>
+        * This method will remove a page that was previously added via touch()
+        * 
+        * @param page
+        */
+       public final void untouch(Page page)
+       {
+               List lst = (List)touchedPages.get();
+               if (lst != null)
+               {
+                       lst.remove(page);
+               }
+       }
+
+       /**
         * @param visitor
         *            The visitor to call at each Page in this PageMap.
         */

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/PageWindowManager.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/PageWindowManager.java?rev=574871&r1=574870&r2=574871&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/PageWindowManager.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/PageWindowManager.java
 Wed Sep 12 02:52:52 2007
@@ -25,9 +25,9 @@
 /**
  * Manages positions and size of serialized pages in the pagemap file.
  * <p>
- * The pages are stored inside the file in a cyclic way. Newer pages are placed
- * after older ones, until the maximum file size is reached. After that, the
- * next page is stored in the beginning of the file.
+ * The pages are stored inside the file in a cyclic way. Newer pages are 
placed after older ones,
+ * until the maximum file size is reached. After that, the next page is stored 
in the beginning of
+ * the file.
  * 
  * @author Matej Knopp
  */
@@ -197,8 +197,8 @@
        private int indexPointer = -1;
 
        /**
-        * Increments the [EMAIL PROTECTED] #indexPointer}. If the maximum file 
size has ben
-        * reeched, the [EMAIL PROTECTED] #indexPointer} is set to 0.
+        * Increments the [EMAIL PROTECTED] #indexPointer}. If the maximum file 
size has ben reeched, the
+        * [EMAIL PROTECTED] #indexPointer} is set to 0.
         * 
         * @return
         */
@@ -216,9 +216,8 @@
        }
 
        /**
-        * Returns the offset in file of the window on given index. The offset 
is
-        * counted by getting the previous page offset and adding the previous 
page
-        * size to it.
+        * Returns the offset in file of the window on given index. The offset 
is counted by getting the
+        * previous page offset and adding the previous page size to it.
         * 
         * @param index
         * @return
@@ -237,9 +236,8 @@
        }
 
        /**
-        * Splits the window with given index to two windows. First of those 
will
-        * have size specified by the argument, the other one will fill up the 
rest
-        * of the original window.
+        * Splits the window with given index to two windows. First of those 
will have size specified by
+        * the argument, the other one will fill up the rest of the original 
window.
         * 
         * @param index
         * @param size
@@ -271,8 +269,8 @@
        }
 
        /**
-        * Merges the window with given index with the next window. The 
resulting
-        * window will have size of the two windows summed together.
+        * Merges the window with given index with the next window. The 
resulting window will have size
+        * of the two windows summed together.
         * 
         * @param index
         */
@@ -290,11 +288,10 @@
        }
 
        /**
-        * Adjusts the window on given index to the specified size. If the new 
size
-        * is smaller than the window size, the window will be splitted. 
Otherwise
-        * the window will be merged with as many subsequent window as 
necessary. In
-        * case the window is last window in the file, the size will be adjusted
-        * without splitting or merging.
+        * Adjusts the window on given index to the specified size. If the new 
size is smaller than the
+        * window size, the window will be splitted. Otherwise the window will 
be merged with as many
+        * subsequent window as necessary. In case the window is last window in 
the file, the size will
+        * be adjusted without splitting or merging.
         * 
         * @param index
         * @param size
@@ -338,9 +335,9 @@
        }
 
        /**
-        * Allocates window on given index with to size. If the index is 
pointing to
-        * existing window, the window size will be adjusted. Otherwise a new 
window
-        * with appropriated size will be created.
+        * Allocates window on given index with to size. If the index is 
pointing to existing window,
+        * the window size will be adjusted. Otherwise a new window with 
appropriated size will be
+        * created.
         * 
         * @param index
         * @param size
@@ -420,8 +417,7 @@
                }
 
                /**
-                * @return offset in the pagemap file where the serialized page 
data
-                *         starts
+                * @return offset in the pagemap file where the serialized page 
data starts
                 */
                public int getFilePartOffset()
                {
@@ -539,10 +535,17 @@
                }
                List indices = (List)idToWindowIndices.get(pageId);
 
-               for (Iterator i = indices.iterator(); i.hasNext();)
+               if (indices != null)
                {
-                       PageWindowInternal window = 
(PageWindowInternal)i.next();
-                       removePage(window.pageId, window.versionNumber, 
window.ajaxVersionNumber);
+                       for (Iterator i = indices.iterator(); i.hasNext();)
+                       {
+                               int index = ((Integer)i.next()).intValue();
+                               PageWindowInternal window = 
(PageWindowInternal)windows.get(index);
+                               if (window.pageId == pageId)
+                               {
+                                       removePage(window.pageId, 
window.versionNumber, window.ajaxVersionNumber);
+                               }
+                       }
                }
        }
 
@@ -588,8 +591,8 @@
         * Creates a new PageWindowManager.
         * 
         * @param maxSize
-        *            maximum page size. After this size is exceeded, the pages 
will
-        *            be saved starting at the beginning of file
+        *            maximum page size. After this size is exceeded, the pages 
will be saved starting
+        *            at the beginning of file
         */
        public PageWindowManager(int maxSize)
        {


Reply via email to