You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2009/11/13 00:36:59 UTC
svn commit: r835641 [1/2] - in /wicket/trunk: ./
testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/
wicket-devutils/src/main/java/org/apache/wicket/devutils/ wicket-examples/
wicket-examples/src/main/java/org/apache/wicket/...
Author: knopp
Date: Thu Nov 12 23:36:57 2009
New Revision: 835641
URL: http://svn.apache.org/viewvc?rev=835641&view=rev
Log:
replaced SecondLevelCacheSessionStore with PageManager; removed pagemap
Removed:
wicket/trunk/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/IPageMap.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/PageMap.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/TestFilePageStore.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/
wicket/trunk/wicket/src/main/java/org/apache/wicket/session/pagemap/
wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/FilePageStoreTest.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/pagestore/
Modified:
wicket/trunk/pom.xml
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/TestApp1.java
wicket/trunk/wicket-devutils/src/main/java/org/apache/wicket/devutils/DevUtilsPage.java
wicket/trunk/wicket-examples/pom.xml
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java
wicket/trunk/wicket-examples/src/main/webapp/WEB-INF/web.xml
wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceWebApplicationFactory.java
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettings.java
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettingsMBean.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/PageReference.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupCloseLink.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycleProcessor.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/urlcompressing/UrlCompressingWebCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/HybridUrlCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/IndexedParamUrlCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/MixedParamUrlCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/coding/QueryStringUrlCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkableListenerInterfaceRequestTarget.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/IPageSettings.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/ISessionSettings.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/Settings.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/WicketTester.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/debug/WicketComponentTreeTestPage_ExpectedResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkableContinueToPage.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/link/BookmarkablePageLinkTest.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/redirect/encodingtest/B.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/redirect/encodingtest/RequestEncodingTest.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/redirect/intercept/InterceptTest.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/IndexParamWithStatelessIFrameTest.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Default_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Default_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Hybrid_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Hybrid_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Indexed_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Indexed_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_QueryString_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_QueryString_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Default_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Default_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Hybrid_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Hybrid_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Indexed_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Indexed_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_QueryString_Result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_QueryString_SubmitResult.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/StatelessComponentPageWithParams_indexed_mount_result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/StatelessComponentPageWithParams_mount_result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/StatelessComponentPageWithParams_result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/StatelessComponentPage_mount_result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/StatelessComponentPage_result.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/util/tester/apps_1/CreateBook.java
Modified: wicket/trunk/pom.xml
URL: http://svn.apache.org/viewvc/wicket/trunk/pom.xml?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/pom.xml (original)
+++ wicket/trunk/pom.xml Thu Nov 12 23:36:57 2009
@@ -32,7 +32,9 @@
<modules>
<module>wicket</module>
<module>wicket-datetime</module>
+ <!-- TODO NG
<module>wicket-devutils</module>
+ -->
<module>wicket-extensions</module>
<module>wicket-ioc</module>
<module>wicket-spring</module>
@@ -100,7 +102,9 @@
<modules>
<module>wicket</module>
<module>wicket-datetime</module>
+ <!-- TODO NG
<module>wicket-devutils</module>
+ -->
<module>wicket-extensions</module>
<module>wicket-ioc</module>
<module>wicket-spring</module>
@@ -172,7 +176,9 @@
<modules>
<module>wicket</module>
<module>wicket-datetime</module>
+ <!-- TODO NG
<module>wicket-devutils</module>
+ -->
<module>wicket-extensions</module>
<module>wicket-ioc</module>
<module>wicket-spring</module>
@@ -260,12 +266,14 @@
<version>${project.version}</version>
<type>jar</type>
</dependency>
+ <!-- TODO NG
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-devutils</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
+ -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/TestApp1.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/TestApp1.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/TestApp1.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/TestApp1.java Thu Nov 12 23:36:57 2009
@@ -19,9 +19,8 @@
import org.apache.wicket.Application;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.image.resource.DefaultButtonImageResource;
-import org.apache.wicket.protocol.http.SecondLevelCacheSessionStore;
+import org.apache.wicket.protocol.http.HttpSessionStore;
import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.protocol.http.pagestore.DiskPageStore;
import org.apache.wicket.session.ISessionStore;
/**
@@ -69,7 +68,6 @@
@Override
protected ISessionStore newSessionStore()
{
- return new SecondLevelCacheSessionStore(this, new DiskPageStore());
- // return new HttpSessionStore();
+ return new HttpSessionStore(this);
}
}
Modified: wicket/trunk/wicket-devutils/src/main/java/org/apache/wicket/devutils/DevUtilsPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-devutils/src/main/java/org/apache/wicket/devutils/DevUtilsPage.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-devutils/src/main/java/org/apache/wicket/devutils/DevUtilsPage.java (original)
+++ wicket/trunk/wicket-devutils/src/main/java/org/apache/wicket/devutils/DevUtilsPage.java Thu Nov 12 23:36:57 2009
@@ -16,7 +16,6 @@
*/
package org.apache.wicket.devutils;
-import org.apache.wicket.IPageMap;
import org.apache.wicket.PageParameters;
import org.apache.wicket.devutils.debugbar.DebugBar;
import org.apache.wicket.markup.html.WebPage;
@@ -41,21 +40,6 @@
init();
}
- public DevUtilsPage(IPageMap pageMap, IModel<?> model) {
- super(pageMap, model);
- init();
- }
-
- public DevUtilsPage(IPageMap pageMap, PageParameters parameters) {
- super(pageMap, parameters);
- init();
- }
-
- public DevUtilsPage(IPageMap pageMap) {
- super(pageMap);
- init();
- }
-
public DevUtilsPage(PageParameters parameters) {
super(parameters);
init();
Modified: wicket/trunk/wicket-examples/pom.xml
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/pom.xml?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/pom.xml (original)
+++ wicket/trunk/wicket-examples/pom.xml Thu Nov 12 23:36:57 2009
@@ -62,10 +62,12 @@
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
</dependency>
+ <!-- TODO NG
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-devutils</artifactId>
</dependency>
+ -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java Thu Nov 12 23:36:57 2009
@@ -17,7 +17,6 @@
package org.apache.wicket.examples;
import org.apache.wicket.RequestContext;
-import org.apache.wicket.devutils.debugbar.DebugBar;
import org.apache.wicket.examples.source.SourcesPage;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
@@ -58,7 +57,8 @@
}
};
add(hideInPortlet);
- hideInPortlet.add(new DebugBar("debug"));
+ // hideInPortlet.add(new DebugBar("debug"));
+ hideInPortlet.add(new WebMarkupContainer("debug"));
add(new Label("exampleTitle", exampleTitle));
BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("sources",
SourcesPage.class, SourcesPage.generatePageParameters(page));
Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java Thu Nov 12 23:36:57 2009
@@ -64,7 +64,6 @@
final ModalWindow modal;
add(modal = new ModalWindow("modal"));
- modal.setPageMapName("modal-2");
modal.setCookieName("modal window 2");
Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java Thu Nov 12 23:36:57 2009
@@ -46,7 +46,6 @@
final ModalWindow modal1;
add(modal1 = new ModalWindow("modal1"));
- modal1.setPageMapName("modal-1");
modal1.setCookieName("modal-1");
modal1.setPageCreator(new ModalWindow.PageCreator()
Modified: wicket/trunk/wicket-examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/webapp/WEB-INF/web.xml?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/webapp/WEB-INF/web.xml (original)
+++ wicket/trunk/wicket-examples/src/main/webapp/WEB-INF/web.xml Thu Nov 12 23:36:57 2009
@@ -385,6 +385,7 @@
</init-param>
</filter>
+<!--
<filter>
<filter-name>SpringExample</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
@@ -394,6 +395,8 @@
</init-param>
</filter>
+ -->
+
<filter>
<filter-name>GuiceApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
@@ -688,6 +691,8 @@
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
+<!--
+
<filter-mapping>
<filter-name>SpringExample</filter-name>
<url-pattern>/spring/*</url-pattern>
@@ -695,6 +700,8 @@
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
+ -->
+
<filter-mapping>
<filter-name>GuiceApplication</filter-name>
<url-pattern>/guice/*</url-pattern>
Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalWindow.java Thu Nov 12 23:36:57 2009
@@ -18,11 +18,9 @@
import org.apache.wicket.Component;
import org.apache.wicket.IClusterable;
-import org.apache.wicket.IPageMap;
import org.apache.wicket.Page;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.ResourceReference;
-import org.apache.wicket.Session;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -37,7 +35,6 @@
import org.apache.wicket.markup.html.resources.JavascriptResourceReference;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
-import org.apache.wicket.request.RequestParameters;
import org.apache.wicket.settings.IPageSettings;
import org.apache.wicket.util.lang.EnumeratedType;
import org.apache.wicket.util.string.AppendingStringBuffer;
@@ -60,12 +57,8 @@
* <code>{@link #setPageCreator(ModalWindow.PageCreator)}</code> method.
* </ul>
* In case the content is a component, it is not rendered until the window is shown (method
- * <code>{@link #show(AjaxRequestTarget)})</code>. In case the content is another page, you can set
- * the desired pagemap name using <code>{@link #setPageMapName(String)}</code>. Setting pagemap is
- * only needed when wicket multiwindow support is on.
- * <p>
- * The window can be made visible from an ajax handler using
- * <code>{@link #show(AjaxRequestTarget)}</code>.
+ * <code>{@link #show(AjaxRequestTarget)})</code>. The window can be made visible from an ajax
+ * handler using <code>{@link #show(AjaxRequestTarget)}</code>.
* <p>
* To close the window there are multiple options. Static method
* <code>{@link #close(AjaxRequestTarget)}</code> can be used to close the window from a handler of
@@ -133,8 +126,6 @@
private static ResourceReference CSS = new CompressedResourceReference(ModalWindow.class,
"res/modal.css");
- private boolean deletePageMap = false;
-
/** True while the ModalWindows is showing */
private boolean shown = false;
@@ -156,8 +147,6 @@
private IModel<String> title = null;
private MaskType maskType = MaskType.SEMI_TRANSPARENT;
- private String pageMapName = "modal-dialog-pagemap";
-
private PageCreator pageCreator = null;
private CloseButtonCallback closeButtonCallback = null;
private WindowClosedCallback windowClosedCallback = null;
@@ -273,29 +262,6 @@
return shown;
}
- /**
- * Sets the name of the page ma for the content page. This makes only sense when the content is
- * a page, not a component and if wicket multiwindow support is turned on.
- *
- * @param pageMapName
- * Name of the page map
- * @return this
- */
- public ModalWindow setPageMapName(final String pageMapName)
- {
- this.pageMapName = pageMapName;
- return this;
- }
-
- /**
- * Returns the page map name.
- *
- * @return The page map name.
- */
- public String getPageMapName()
- {
- return pageMapName;
- }
/**
* Sets the <code>{@link PageCreator}</code> instance. The instance is only used when no custom
@@ -779,29 +745,7 @@
}
else
{
- RequestParameters parameters = RequestCycle.get().getRequest().getRequestParameters();
- String oldPageMapName = parameters.getPageMapName();
-
- // if there is a pagemap name specified and multiwindow support is on
- if (getPageMapName() != null)
- {
- // try to find out whether the pagemap already exists
- Session session = Session.get();
- if (session.pageMapForName(getPageMapName(), false) == null)
- {
- deletePageMap = true;
- }
- parameters.setPageMapName(getPageMapName());
- }
-
- try
- {
- return pageCreator.createPage();
- }
- finally
- {
- parameters.setPageMapName(oldPageMapName);
- }
+ return pageCreator.createPage();
}
}
@@ -909,21 +853,6 @@
{
shown = false;
- // should we cleanup the pagemap?
- if (deletePageMap == true)
- {
- // get the pagemap
- Session session = Session.get();
- IPageMap pageMap = session.pageMapForName(getPageMapName(), false);
-
- // if there is any remove it
- if (pageMap != null)
- {
- session.removePageMap(pageMap);
- deletePageMap = false;
- }
- }
-
if (windowClosedCallback != null)
{
windowClosedCallback.onClose(target);
@@ -1053,11 +982,6 @@
RequestCycle.get().setUrlForNewWindowEncoding();
appendAssignment(buffer, "settings.src", RequestCycle.get().urlFor(page));
-
- if (getPageMapName() != null)
- {
- appendAssignment(buffer, "settings.iframeName", getPageMapName());
- }
}
else
{
@@ -1089,7 +1013,7 @@
// in case user is interested in window close callback or we have a pagemap to clean attach
// notification request
- if ((isCustomComponent() == false && deletePageMap) || windowClosedCallback != null)
+ if (windowClosedCallback != null)
{
WindowClosedBehavior behavior = getBehaviors(WindowClosedBehavior.class).get(0);
buffer.append("settings.onClose = function() { ");
Modified: wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceWebApplicationFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceWebApplicationFactory.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceWebApplicationFactory.java (original)
+++ wicket/trunk/wicket-guice/src/main/java/org/apache/wicket/guice/GuiceWebApplicationFactory.java Thu Nov 12 23:36:57 2009
@@ -37,7 +37,7 @@
* <pre>
* <filter>
* <filter-name>MyApplication</filter-name>
- * <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ * <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
* <init-param>
* <param-name>applicationClassName</param-name>
* <param-value>org.apache.wicket.guice.GuiceWebApplicationFactory</param-value>
@@ -68,7 +68,7 @@
* <pre>
* <filter>
* <filter-name>MyApplication</filter-name>
- * <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ * <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
* <init-param>
* <param-name>applicationClassName</param-name>
* <param-value>org.apache.wicket.guice.GuiceWebApplicationFactory</param-value>
@@ -175,4 +175,8 @@
app.addComponentInstantiationListener(new GuiceComponentInjector(app, injector));
return app;
}
+
+ public void destroy()
+ {
+ }
}
Modified: wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettings.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettings.java (original)
+++ wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettings.java Thu Nov 12 23:36:57 2009
@@ -52,14 +52,6 @@
}
/**
- * @see org.apache.wicket.jmx.SessionSettingsMBean#getPageMapEvictionStrategy()
- */
- public String getPageMapEvictionStrategy()
- {
- return Stringz.className(application.getSessionSettings().getPageMapEvictionStrategy());
- }
-
- /**
* @see org.apache.wicket.jmx.SessionSettingsMBean#getSessionStore()
*/
public String getSessionStore()
Modified: wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettingsMBean.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettingsMBean.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettingsMBean.java (original)
+++ wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/SessionSettingsMBean.java Thu Nov 12 23:36:57 2009
@@ -39,13 +39,6 @@
String getPageFactory();
/**
- * Gets the strategy for evicting pages from the page map.
- *
- * @return the strategy for evicting pages from the page map
- */
- String getPageMapEvictionStrategy();
-
- /**
* Gets the session store implementation.
*
* @return the session store implementation
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Thu Nov 12 23:36:57 2009
@@ -16,7 +16,6 @@
*/
package org.apache.wicket;
-import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -924,7 +923,9 @@
*/
public final boolean continueToOriginalDestination()
{
- return getPage().getPageMap().continueToOriginalDestination();
+ // TODO WICKET-NG
+ return false;
+ // return getPage().getPageMap().continueToOriginalDestination();
}
/**
@@ -2039,7 +2040,8 @@
*/
public final void redirectToInterceptPage(final Page page)
{
- getPage().getPageMap().redirectToInterceptPage(page);
+ // TODO WICKET-NG
+ // getPage().getPageMap().redirectToInterceptPage(page);
}
/**
@@ -4076,40 +4078,6 @@
return isVisible() && isRenderAllowed() && isVisibilityAllowed();
}
- /**
- *
- * @param s
- * @throws IOException
- */
- private void writeObject(java.io.ObjectOutputStream s) throws IOException
- {
- if (this instanceof Page)
- {
- ((Page)this).writePageObject(s);
- }
- else
- {
- s.defaultWriteObject();
- }
- }
-
- /**
- *
- * @param s
- * @throws IOException
- * @throws ClassNotFoundException
- */
- private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException
- {
- if (this instanceof Page)
- {
- ((Page)this).readPageObject(s);
- }
- else
- {
- s.defaultReadObject();
- }
- }
/**
* Calculates enabled state of the component taking its hierarchy into account. A component is
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java Thu Nov 12 23:36:57 2009
@@ -37,9 +37,7 @@
import org.apache.wicket.markup.resolver.IComponentResolver;
import org.apache.wicket.model.IModel;
import org.apache.wicket.ng.page.ManageablePage;
-import org.apache.wicket.request.RequestParameters;
import org.apache.wicket.session.ISessionStore;
-import org.apache.wicket.session.pagemap.IPageMapEntry;
import org.apache.wicket.settings.IDebugSettings;
import org.apache.wicket.util.lang.Classes;
import org.apache.wicket.util.lang.Objects;
@@ -119,11 +117,7 @@
* @author Johan Compagner
*
*/
-public abstract class Page extends MarkupContainer
- implements
- IRedirectListener,
- IPageMapEntry,
- ManageablePage
+public abstract class Page extends MarkupContainer implements IRedirectListener, ManageablePage
{
/**
* You can set implementation of the interface in the {@link Page#serializer} then that
@@ -208,12 +202,6 @@
/** Numeric version of this page's id */
private int numericId;
- /** The PageMap within the session that this page is stored in */
- private transient IPageMap pageMap;
-
- /** Name of PageMap that this page is stored in */
- private String pageMapName;
-
/** Set of components that rendered if component use checking is enabled */
private transient Set<Component> renderedComponents;
@@ -253,37 +241,6 @@
}
/**
- * Constructor.
- *
- * @param pageMap
- * The page map to put this page in
- */
- protected Page(final IPageMap pageMap)
- {
- // A Page's id is not determined until setId is called when the Page is
- // added to a PageMap in the Session.
- super(null);
- init(pageMap);
- }
-
- /**
- * Constructor.
- *
- * @param pageMap
- * the page map to put this page in
- * @param model
- * See Component
- * @see Component#Component(String, IModel)
- */
- protected Page(final IPageMap pageMap, final IModel<?> model)
- {
- // A Page's id is not determined until setId is called when the Page is
- // added to a PageMap in the Session.
- super(null, model);
- init(pageMap);
- }
-
- /**
* The {@link PageParameters} parameter will be stored in this page and then those parameters
* will be used to create stateless links to this bookmarkable page.
*
@@ -299,23 +256,6 @@
}
/**
- * The {@link PageParameters} parameter will be stored in this page and then those parameters
- * will be used to create stateless links to this bookmarkable page.
- *
- * @param pageMap
- * the page map to put this page in
- * @param parameters
- * externally passed parameters
- * @see PageParameters
- */
- protected Page(final IPageMap pageMap, final PageParameters parameters)
- {
- super(null);
- this.parameters = parameters;
- init(pageMap);
- }
-
- /**
* The {@link PageParameters} object that was used to construct this page. This will be used in
* creating stateless/bookmarkable links to this page
*
@@ -409,7 +349,7 @@
*/
public final void dirty()
{
- Session.get().dirtyPage(this);
+ // TODO: Increment page id here if manager supports versioning
}
/**
@@ -474,44 +414,11 @@
}
/**
- * @return Returns the PageMap that this Page is stored in.
- */
- public final IPageMap getPageMap()
- {
- // If the transient needs to be restored
- if (pageMap == null)
- {
- // Look the page map up in the session
- pageMap = PageMap.forName(pageMapName);
- }
- return pageMap;
- }
-
- /**
- * @return Get a page map entry for this page. By default, this is the page itself. But if you
- * know of some way to compress the state for the page, you can return a custom
- * implementation that produces the page on-the-fly.
- */
- public IPageMapEntry getPageMapEntry()
- {
- return this;
- }
-
- /**
- * @return String The PageMap name
- */
- public final String getPageMapName()
- {
- return pageMapName;
- }
-
- /**
* @return Size of this page in bytes
*/
@Override
public final long getSizeInBytes()
{
- pageMap = null;
return Objects.sizeof(this);
}
@@ -564,7 +471,7 @@
{
try
{
- if (getClass().getConstructor(new Class[] { }) != null)
+ if (getClass().getConstructor(new Class[] {}) != null)
{
bookmarkable = Boolean.TRUE;
}
@@ -878,50 +785,23 @@
setFlag(FLAG_NEW_VERSION, false);
// Evict any page version(s) as need be
- getApplication().getSessionSettings().getPageMapEvictionStrategy().evict(getPageMap());
+ // getApplication().getSessionSettings().getPageMapEvictionStrategy().evict(getPageMap());
}
}
/**
* Initializes Page by adding it to the Session and initializing it.
- */
- private final void init()
- {
- final RequestCycle cycle = getRequestCycle();
- String pageMapName = null;
- if (cycle != null)
- {
- RequestParameters parameters = getRequest().getRequestParameters();
- pageMapName = parameters.getPageMapName();
- }
-
- final IPageMap pageMap = PageMap.forName(pageMapName);
- init(pageMap);
- }
-
- /**
- * Initializes Page by adding it to the Session and initializing it.
*
* @param pageMap
* The page map to put this page in.
*/
- private final void init(final IPageMap pageMap)
+ private final void init()
{
if (isBookmarkable())
{
setStatelessHint(true);
}
- // Set the page map
- if (pageMap != null)
- {
- setPageMap(pageMap);
- }
- else
- {
- throw new IllegalStateException("PageMap cannot be null");
- }
-
setNextAvailableId();
// Set versioning of page based on default
@@ -936,56 +816,9 @@
*/
private void setNextAvailableId()
{
- if (getApplication().getSessionSettings().isPageIdUniquePerSession())
- {
- setNumericId(getSession().nextPageId());
- }
- else
- {
- // Set the numeric id on this page
- setNumericId(getPageMap().nextId());
- }
+ setNumericId(getSession().nextPageId());
}
- /**
- * For the given component, whether we may record changes.
- *
- * @param component
- * The component which is affected
- * @param parent
- * @return True if the change is okay to report
- */
- private final boolean mayTrackChangesFor(final Component component, MarkupContainer parent)
- {
- // first call the method so that people can track dirty components
- componentChanged(component, parent);
- // Auto components do not participate in versioning since they are
- // added during the rendering phase (which is normally illegal).
- if (component.isAuto() || (parent == null && !component.isVersioned()) ||
- (parent != null && !parent.isVersioned()))
- {
- return false;
- }
- else
- {
- // the component is versioned... are we tracking changes at all?
- if (getFlag(FLAG_TRACK_CHANGES))
- {
- // we are tracking changes... do we need to start new version?
- if (!getFlag(FLAG_NEW_VERSION))
- {
- // TODO WICKET-NG do we need to do anything here? or this method at all?
- setFlag(FLAG_NEW_VERSION, true);
- }
-
- // return true as we are ready for versioning
- return true;
- }
-
- // we are not tracking changes or the component not versioned
- return false;
- }
- }
/**
* This method will be called for all components that are changed on the page So also auto
@@ -1044,28 +877,6 @@
}
/**
- *
- * @param s
- * @throws IOException
- */
- void writePageObject(java.io.ObjectOutputStream s) throws IOException
- {
- s.writeShort(numericId);
- s.writeObject(pageMapName);
-
- IPageSerializer ps = serializer.get();
-
- if (ps != null)
- {
- ps.serializePage(this, s);
- }
- else
- {
- s.defaultWriteObject();
- }
- }
-
- /**
* Set-up response with appropriate content type, locale and encoding. The locale is set equal
* to the session's locale. The content type header contains information about the markup type
* (@see #getMarkupType()) and the encoding. The response (and request) encoding is determined
@@ -1140,21 +951,6 @@
});
}
- /**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
- *
- * @param map
- */
- protected final void moveToPageMap(IPageMap map)
- {
- // TODO post 1.2 shouldn't we remove this page from the pagemap/session
- // if it would be in there?
- // This should be done if the page was not cloned first, but shouldn't
- // be done if it was cloned..
- setPageMap(map);
-
- setNextAvailableId();
- }
/**
*
@@ -1224,7 +1020,7 @@
Session.get().getSessionStore().getSessionId(RequestCycle.get().getRequest(), true);
// Add/touch the response page in the session (its pagemap).
- getSession().touch(this);
+ getSession().getPageManager().touchPage(this);
}
if (getApplication().getDebugSettings().isOutputMarkupContainerClassName())
@@ -1315,19 +1111,6 @@
dirty();
}
- /**
- * @param pageMap
- * Sets this page into the page map with the given name. If the page map does not yet
- * exist, it is automatically created.
- */
- final void setPageMap(final IPageMap pageMap)
- {
- // Save transient reference to pagemap
- this.pageMap = pageMap;
-
- // Save name for restoring transient
- pageMapName = pageMap.getName();
- }
/**
* Set page stateless
@@ -1364,8 +1147,8 @@
public PageReference getPageReference()
{
setStatelessHint(false);
- // TODO WICKET-NG will reference need page version/render count? for now we always send zero
- return new PageReference(pageMapName, numericId, 0);
+
+ return new PageReference(numericId);
}
/**
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/PageReference.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/PageReference.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/PageReference.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/PageReference.java Thu Nov 12 23:36:57 2009
@@ -26,22 +26,19 @@
{
private static final long serialVersionUID = 1L;
- private final String pageMapName;
- private final int number;
- private final int version;
+ private final int pageId;
/**
* Constructor
*
* @param pageMapName
- * @param number
+ * @param pageId
* @param version
*/
- PageReference(String pageMapName, int number, int version)
+ PageReference(int pageId)
{
- this.pageMapName = pageMapName;
- this.number = number;
- this.version = version;
+ this.pageId = pageId;
+ ;
}
/**
@@ -49,39 +46,17 @@
*/
public Page getPage()
{
- return Session.get().getPage(pageMapName, Integer.toString(number), version);
+ return (Page)Session.get().getPageManager().getPage(pageId);
}
/**
- * Gets pageMapName.
- *
- * @return pageMapName
- */
- public String getPageMapName()
- {
- return pageMapName;
- }
-
-
- /**
* Gets pageId.
*
* @return pageId
*/
- public int getPageNumber()
+ public int getPageId()
{
- return number;
- }
-
-
- /**
- * Gets pageVersion.
- *
- * @return pageVersion
- */
- public int getPageVersion()
- {
- return version;
+ return pageId;
}
@@ -91,12 +66,7 @@
@Override
public int hashCode()
{
- final int prime = 31;
- int result = 1;
- result = prime * result + number;
- result = prime * result + ((pageMapName == null) ? 0 : pageMapName.hashCode());
- result = prime * result + version;
- return result;
+ return pageId;
}
/**
@@ -118,26 +88,7 @@
return false;
}
PageReference other = (PageReference)obj;
- if (number != other.number)
- {
- return false;
- }
- if (pageMapName == null)
- {
- if (other.pageMapName != null)
- {
- return false;
- }
- }
- else if (!pageMapName.equals(other.pageMapName))
- {
- return false;
- }
- if (version != other.version)
- {
- return false;
- }
- return true;
+ return getPageId() == other.getPageId();
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java Thu Nov 12 23:36:57 2009
@@ -120,9 +120,7 @@
* <p>
* <table>
* <tr>
- * <th align = "left">Class</th>
- * <th align = "left">Interface</th>
- * <th align="left">Purpose</th>
+ * <th align = "left">Class</th> <th align = "left">Interface</th> <th align="left">Purpose</th>
* </tr>
* <tr>
* <td>Form</td>
@@ -670,28 +668,6 @@
return orig;
}
- /**
- * Attempts to return name of current page map
- *
- * @return name of current page map or null if none
- */
- private String getCurrentPageMap()
- {
- IRequestTarget target = RequestCycle.get().getRequestTarget();
- if (target instanceof IPageRequestTarget)
- {
- Page page = ((IPageRequestTarget)target).getPage();
- return page != null ? page.getPageMapName() : null;
- }
- else if (target instanceof IBookmarkablePageRequestTarget)
- {
- return PageMap.DEFAULT_NAME;
- }
- else
- {
- return null;
- }
- }
/**
* Convenience method that sets page class as the response. This will generate a redirect to the
@@ -873,8 +849,8 @@
}
}
- target = new BookmarkableListenerInterfaceRequestTarget(page.getPageMapName(),
- page.getClass(), pageParameters, component, listener);
+ target = new BookmarkableListenerInterfaceRequestTarget("default", page.getClass(),
+ pageParameters, component, listener);
return encodeUrlFor(target);
}
else
@@ -971,7 +947,7 @@
public final CharSequence urlFor(final Page page)
{
IRequestTarget target = new PageRequestTarget(page);
- getSession().touch(((IPageRequestTarget)target).getPage());
+ getSession().getPageManager().touchPage(((IPageRequestTarget)target).getPage());
return encodeUrlFor(target);
}
@@ -1160,6 +1136,8 @@
log.error("Exception occurred during onEndRequest of the SessionStore", e);
}
+ getApplication().getPageManager().commitRequest();
+
// Release thread local resources
try
{
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java Thu Nov 12 23:36:57 2009
@@ -16,7 +16,6 @@
*/
package org.apache.wicket;
-import org.apache.wicket.request.RequestParameters;
/**
* Causes Wicket to interrupt current request processing and immediately redirect to an intercept
@@ -79,24 +78,8 @@
*/
private void redirectToInterceptPage(final Page interceptPage)
{
- final Page requestPage = RequestCycle.get().getRequest().getPage();
-
- /*
- * requestPage can be null if we throw the restart response exception before any page is
- * instantiated in user's session. if this happens we switch to the pagemap of the
- * interceptPage
- */
- final IPageMap pageMap;
- if (requestPage != null)
- {
- pageMap = requestPage.getPageMap();
- }
- else
- {
- pageMap = interceptPage.getPageMap();
- }
-
- pageMap.redirectToInterceptPage(interceptPage);
+ // TODO Wicket NG: Implement
+ RequestCycle.get().setResponsePage(interceptPage);
}
/**
@@ -110,24 +93,8 @@
*/
private <C extends Page> void redirectToInterceptPage(final Class<C> interceptPageClass)
{
- final RequestCycle cycle = RequestCycle.get();
- final Page requestPage = cycle.getRequest().getPage();
-
- /*
- * requestPage can be null if we throw the restart response exception before any page is
- * instantiated in user's session. if this happens we switch to the pagemap of the request.
- */
- final IPageMap pageMap;
- if (requestPage != null)
- {
- pageMap = requestPage.getPageMap();
- }
- else
- {
- RequestParameters parameters = cycle.getRequest().getRequestParameters();
- pageMap = PageMap.forName(parameters.getPageMapName());
- }
+ // TODO Wicket NG: Implement
+ RequestCycle.get().setResponsePage(interceptPageClass);
- pageMap.redirectToInterceptPage(interceptPageClass);
}
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java Thu Nov 12 23:36:57 2009
@@ -20,26 +20,19 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
import org.apache.wicket.application.IClassResolver;
import org.apache.wicket.authorization.IAuthorizationStrategy;
import org.apache.wicket.feedback.FeedbackMessage;
import org.apache.wicket.feedback.FeedbackMessages;
-import org.apache.wicket.protocol.http.IgnoreAjaxRequestException;
+import org.apache.wicket.ng.page.PageManager;
import org.apache.wicket.request.ClientInfo;
import org.apache.wicket.session.ISessionStore;
import org.apache.wicket.util.lang.Objects;
-import org.apache.wicket.util.string.AppendingStringBuffer;
-import org.apache.wicket.util.string.Strings;
-import org.apache.wicket.util.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -113,50 +106,12 @@
*/
public abstract class Session implements IClusterable
{
- /**
- * Visitor interface for visiting page maps
- *
- * @author Jonathan Locke
- */
- public static interface IPageMapVisitor
- {
- /**
- * @param pageMap
- * The page map
- */
- public void pageMap(final IPageMap pageMap);
- }
-
- /**
- * meta data for recording map map access.
- */
- public static final class PageMapAccessMetaData implements IClusterable
- {
- private static final long serialVersionUID = 1L;
-
- Set<String> pageMapNames = new HashSet<String>(2);
-
- /**
- * @param pagemap
- * the pagemap to add as used.
- * @return the boolean if it was added (didn't already contain the pagemap)
- */
- public boolean add(IPageMap pagemap)
- {
- return pageMapNames.add(pagemap.getName());
- }
- }
private static final long serialVersionUID = 1L;
/** Logging object */
private static final Logger log = LoggerFactory.getLogger(Session.class);
- /** meta data key for missing body tags logging. */
- public static final MetaDataKey<PageMapAccessMetaData> PAGEMAP_ACCESS_MDK = new MetaDataKey<PageMapAccessMetaData>()
- {
- private static final long serialVersionUID = 1L;
- };
/** Name of session attribute under which this session is stored */
public static final String SESSION_ATTRIBUTE_NAME = "session";
@@ -164,23 +119,11 @@
/** Thread-local current session. */
private static final ThreadLocal<Session> current = new ThreadLocal<Session>();
- /** A store for dirty objects for one request */
- private static final ThreadLocal<List<IClusterable>> dirtyObjects = new ThreadLocal<List<IClusterable>>();
-
- /** Attribute prefix for page maps stored in the session */
- private static final String pageMapAttributePrefix = "m:";
-
- /** A store for touched pages for one request */
- private static final ThreadLocal<List<Page>> touchedPages = new ThreadLocal<List<Page>>();
-
- /** Prefix for attributes holding page map entries */
- static final String pageMapEntryAttributePrefix = "p:";
-
/** a sequence used for whenever something session-specific needs a unique value */
private int sequence = 1;
- /** */
- private int pageIdCounter = 0;
+ /** a sequence used for generating page IDs */
+ private int pageId = 0;
/**
* Checks if the <code>Session</code> threadlocal is set in this thread
@@ -224,18 +167,23 @@
ISessionStore sessionStore = application.getSessionStore();
Session session = sessionStore.lookup(request);
+ boolean created = false;
+
if (session == null)
{
// Create session using session factory
session = application.newSession(request, response);
-
- dirtyObjects.set(null);
- touchedPages.set(null);
+ created = true;
}
// set thread local
set(session);
+ if (created)
+ {
+ application.getPageManager().newSessionCreated();
+ }
+
return session;
}
@@ -286,9 +234,6 @@
current.set(null);
}
- /** A number to generate names for auto create pagemaps */
- private int autoCreatePageMapCounter = 0;
-
/**
* Cached instance of agent info which is typically designated by calling
* {@link RequestCycle#newClientInfo()}.
@@ -310,17 +255,6 @@
/** Application level meta data. */
private MetaDataEntry<?>[] metaData;
- /**
- * We need to know both thread that keeps the pagemap lock and the RequestCycle
- */
- private static class PageMapsUsedInRequestEntry
- {
- Thread thread;
- RequestCycle requestCycle;
- };
-
- private transient Map<IPageMap, PageMapsUsedInRequestEntry> pageMapsUsedInRequest;
-
/** True, if session has been invalidated */
private transient boolean sessionInvalidated = false;
@@ -344,9 +278,6 @@
*/
private transient Map<String, Object> temporarySessionAttributes;
- /** A linked list for last used pagemap queue */
- private final LinkedList/* <IPageMap> */<IPageMap> usedPageMaps = new LinkedList<IPageMap>();
-
/**
* Constructor. Note that {@link RequestCycle} is not available until this constructor returns.
*
@@ -422,72 +353,7 @@
*/
public final void clear()
{
- visitPageMaps(new IPageMapVisitor()
- {
- public void pageMap(IPageMap pageMap)
- {
- pageMap.clear();
- }
- });
- }
-
- /**
- * Automatically creates a page map, giving it a session unique name.
- *
- * @return Created PageMap
- */
- public final IPageMap createAutoPageMap()
- {
- return newPageMap(createAutoPageMapName());
- }
-
- protected int currentCreateAutoPageMapCounter()
- {
- return autoCreatePageMapCounter;
- }
-
- protected void incrementCreateAutoPageMapCounter()
- {
- ++autoCreatePageMapCounter;
- }
-
- /**
- * With this call you can create a pagemap name but not create the pagemap itself already. It
- * will give the first pagemap name where it couldn't find a current pagemap for.
- *
- * It will return the same name if you call it 2 times in a row.
- *
- * @return The created pagemap name
- */
- public synchronized final String createAutoPageMapName()
- {
- String name = getAutoPageMapNamePrefix() + currentCreateAutoPageMapCounter() +
- getAutoPageMapNameSuffix();
- IPageMap pm = pageMapForName(name, false);
- while (pm != null)
- {
- incrementCreateAutoPageMapCounter();
- name = getAutoPageMapNamePrefix() + currentCreateAutoPageMapCounter() +
- getAutoPageMapNameSuffix();
- pm = pageMapForName(name, false);
- }
- return name;
- }
-
- /**
- * @return The prefixed string default "wicket-".
- */
- protected String getAutoPageMapNamePrefix()
- {
- return "wicket-";
- }
-
- /**
- * @return The suffix default an empty string.
- */
- protected String getAutoPageMapNameSuffix()
- {
- return "";
+ // TODO:
}
/**
@@ -547,14 +413,6 @@
}
/**
- * @return The default page map
- */
- public final IPageMap getDefaultPageMap()
- {
- return pageMapForName(PageMap.DEFAULT_NAME, true);
- }
-
- /**
* Gets feedback messages stored in session
*
* @return unmodifiable list of feedback messages
@@ -623,162 +481,6 @@
}
/**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
- *
- * Returns the page with given id and versionNumber. It keeps asking pageMaps for given page
- * until it finds one that contains it.
- *
- * @param pageId
- * @param versionNumber
- * @return The page of that pageid and version, null if not found
- */
- public final Page getPage(final int pageId, final int versionNumber)
- {
- if (Application.get().getSessionSettings().isPageIdUniquePerSession() == false)
- {
- throw new IllegalStateException(
- "To call this method ISessionSettings.setPageIdUniquePerSession must be set to true");
- }
-
- List<IPageMap> pageMaps = getPageMaps();
-
- for (IPageMap pageMap : pageMaps)
- {
- if (pageMap.containsPage(pageId, versionNumber))
- {
- return getPage(pageMap.getName(), "" + pageId, versionNumber);
- }
- }
-
- return null;
- }
-
- /**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
- *
- * Get the page for the given path.
- *
- * FIXME javadoc - where does it look? where does it get the page from?
- *
- * @param pageMapName
- * The name of the page map where the page is
- * @param componentPath
- * Component path
- * @param versionNumber
- * The version of the page required
- * @return The page based on the first path component (the page id), or null if the requested
- * version of the page cannot be found.
- */
- public final Page getPage(final String pageMapName, final String componentPath,
- final int versionNumber)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Getting page [path = " + componentPath + ", versionNumber = " +
- versionNumber + "]");
- }
-
- // Get page map by name, creating the default page map automatically
- IPageMap pageMap = pageMapForName(pageMapName, pageMapName == PageMap.DEFAULT_NAME);
- if (pageMap != null)
- {
- synchronized (usedPageMaps) // get a lock so be sure that only one
- // is made
- {
- if (pageMapsUsedInRequest == null)
- {
- pageMapsUsedInRequest = new HashMap<IPageMap, PageMapsUsedInRequestEntry>(3);
- }
- }
- synchronized (pageMapsUsedInRequest)
- {
- long startTime = System.currentTimeMillis();
-
- // TODO For now only use the setting. Might be extended with
- // something overridable on request/ page/ request target level
- // later
- Duration timeout = Application.get().getRequestCycleSettings().getTimeout();
-
- PageMapsUsedInRequestEntry entry = pageMapsUsedInRequest.get(pageMap);
-
- // Get page entry for id and version
- Thread t = entry != null ? entry.thread : null;
- while (t != null && t != Thread.currentThread())
- {
- if (isCurrentRequestValid(entry.requestCycle) == false)
- {
- // we need to ignore this request. That's because it is
- // an ajax request
- // while regular page request is being processed
- throw new IgnoreAjaxRequestException();
- }
-
- try
- {
- pageMapsUsedInRequest.wait(timeout.getMilliseconds());
- }
- catch (InterruptedException ex)
- {
- throw new WicketRuntimeException(ex);
- }
-
- entry = pageMapsUsedInRequest.get(pageMap);
- t = entry != null ? entry.thread : null;
-
- if (t != null && t != Thread.currentThread() &&
- (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
- {
- AppendingStringBuffer asb = new AppendingStringBuffer(100);
- asb.append("After " + timeout + " the Pagemap " + pageMapName +
- " is still locked by: " + t +
- ", giving up trying to get the page for path: " + componentPath);
- // if it is still not the right thread..
- // This either points to long running code (a report
- // page?) or a deadlock or such
- try
- {
- StackTraceElement[] stackTrace = t.getStackTrace();
- asb.append("\n\tBegin of stack trace of " + t);
- for (StackTraceElement stackTraceElement : stackTrace)
- {
- asb.append("\n\t");
- asb.append(stackTraceElement);
- }
- asb.append("\n\tEnd of stack trace of " + t);
- }
- catch (Exception e)
- {
- // ignore
- }
- throw new WicketRuntimeException(asb.toString());
- }
- }
-
- PageMapsUsedInRequestEntry newEntry = new PageMapsUsedInRequestEntry();
- newEntry.thread = Thread.currentThread();
- newEntry.requestCycle = RequestCycle.get();
- pageMapsUsedInRequest.put(pageMap, newEntry);
- final String id = Strings.firstPathComponent(componentPath,
- Component.PATH_SEPARATOR);
- Page page = pageMap.get(Integer.parseInt(id), versionNumber);
- if (page == null)
- {
- pageMapsUsedInRequest.remove(pageMap);
- pageMapsUsedInRequest.notifyAll();
- }
- else
- {
- // attach the page now.
- page.onPageAttached();
- touch(page);
- }
- return page;
- }
- }
- return null;
- }
-
- /**
* @return The page factory for this session
*/
public final IPageFactory getPageFactory()
@@ -787,32 +489,12 @@
}
/**
- * @return A list of all PageMaps in this session.
- */
- public final List<IPageMap> getPageMaps()
- {
- final List<IPageMap> list = new ArrayList<IPageMap>();
- for (String attribute : getAttributeNames())
- {
- if (attribute.startsWith(pageMapAttributePrefix))
- {
- list.add((IPageMap)getAttribute(attribute));
- }
- }
- return list;
- }
-
- /**
* @return Size of this session, including all the pagemaps it contains
*/
public final long getSizeInBytes()
{
- long size = Objects.sizeof(this);
- for (IPageMap pageMap : getPageMaps())
- {
- size += pageMap.getSizeInBytes();
- }
- return size;
+ // TODO WICKET-NG
+ return -1;
}
/**
@@ -898,85 +580,6 @@
}
/**
- * Creates a new page map with a given name
- *
- * @param name
- * The name for the new page map
- * @return The newly created page map
- */
- public final IPageMap newPageMap(final String name)
- {
- // Check that session doesn't have too many page maps already, if so, evict
- final int maxPageMaps = getApplication().getSessionSettings().getMaxPageMaps();
- synchronized (usedPageMaps)
- {
- if (usedPageMaps.size() >= maxPageMaps)
- {
- IPageMap pm = usedPageMaps.getFirst();
- pm.remove();
- }
- }
-
- // Create new page map
- final IPageMap pageMap = getSessionStore().createPageMap(name);
- setAttribute(attributeForPageMapName(name), pageMap);
- dirty();
- return pageMap;
- }
-
- /**
- * Gets a page map for the given name, automatically creating it if need be.
- *
- * @param pageMapName
- * Name of page map, or null for default page map
- * @param autoCreate
- * True if the page map should be automatically created if it does not exist
- * @return PageMap for name
- */
- public final IPageMap pageMapForName(String pageMapName, final boolean autoCreate)
- {
- IPageMap pageMap = (IPageMap)getAttribute(attributeForPageMapName(pageMapName));
- if (pageMap == null && autoCreate)
- {
- pageMap = newPageMap(pageMapName);
- }
- return pageMap;
- }
-
- /**
- * @param pageMap
- * Page map to remove
- */
- public final void removePageMap(final IPageMap pageMap)
- {
- PageMapAccessMetaData pagemapMetaData = getMetaData(PAGEMAP_ACCESS_MDK);
- if (pagemapMetaData != null)
- {
- pagemapMetaData.pageMapNames.remove(pageMap.getName());
- }
-
- synchronized (usedPageMaps)
- {
- usedPageMaps.remove(pageMap);
- }
-
- removeAttribute(attributeForPageMapName(pageMap.getName()));
- dirty();
- }
-
- /**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
- * <p>
- * Sets the application that this session is associated with.
- *
- * @param application
- * The application
- */
- public final void setApplication(final Application application)
- {
- }
-
- /**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
* <p>
* Sets the client info object for this session. This will only work when
@@ -1043,66 +646,6 @@
}
/**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
- * <p>
- * The page will be 'touched' in the session. If it wasn't added yet to the pagemap, it will be
- * added to the page map else it will set this page to the front.
- *
- * If another page was removed because of this it will be cleaned up.
- *
- * @param page
- */
- public final void touch(Page page)
- {
- // store it in a list, so that the pages are really pushed
- // to the pagemap when the session does it update/detaches.
- // all the pages are then detached
- List<Page> lst = touchedPages.get();
- if (lst == null)
- {
- lst = new ArrayList<Page>();
- touchedPages.set(lst);
- lst.add(page);
- }
- else if (!lst.contains(page))
- {
- lst.add(page);
- }
- }
-
- /**
- * 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<Page> lst = touchedPages.get();
- if (lst != null)
- {
- lst.remove(page);
- }
- }
-
- /**
- * @param visitor
- * The visitor to call at each Page in this PageMap.
- */
- public final void visitPageMaps(final IPageMapVisitor visitor)
- {
- for (final Iterator<String> iterator = getAttributeNames().iterator(); iterator.hasNext();)
- {
- final String attribute = iterator.next();
- if (attribute.startsWith(pageMapAttributePrefix))
- {
- visitor.pageMap((IPageMap)getAttribute(attribute));
- }
- }
- }
-
- /**
* Registers a warning feedback message for this session
*
* @param message
@@ -1127,16 +670,6 @@
}
/**
- * @param pageMapName
- * Name of page map
- * @return Session attribute holding page map
- */
- private final String attributeForPageMapName(final String pageMapName)
- {
- return pageMapAttributePrefix + pageMapName;
- }
-
- /**
* Any attach logic for session subclasses. Called when a session is set for the thread.
*/
protected void attach()
@@ -1265,7 +798,6 @@
*/
// TODO WICKET-NG made public for page manager, used to be protected, see if there is a way to
// revert
-
public final void setAttribute(String name, Serializable value)
{
if (!isTemporary())
@@ -1311,53 +843,6 @@
}
}
- /**
- * @param page
- * The page to add to dirty objects list
- */
- void dirtyPage(final Page page)
- {
- List<IClusterable> dirtyObjects = getDirtyObjectsList();
- if (!dirtyObjects.contains(page))
- {
- dirtyObjects.add(page);
- }
- }
-
- /**
- * @param map
- * The page map to add to dirty objects list
- */
- void dirtyPageMap(final IPageMap map)
- {
- if (!map.isDefault())
- {
- synchronized (usedPageMaps)
- {
- usedPageMaps.remove(map);
- usedPageMaps.addLast(map);
- }
- }
- List<IClusterable> dirtyObjects = getDirtyObjectsList();
- if (!dirtyObjects.contains(map))
- {
- dirtyObjects.add(map);
- }
- }
-
- /**
- * @return The current thread dirty objects list
- */
- List<IClusterable> getDirtyObjectsList()
- {
- List<IClusterable> list = dirtyObjects.get();
- if (list == null)
- {
- list = new ArrayList<IClusterable>(4);
- dirtyObjects.set(list);
- }
- return list;
- }
// TODO remove after deprecation release
@@ -1368,20 +853,6 @@
*/
final void requestDetached()
{
- List<Page> touchedPages = Session.touchedPages.get();
- Session.touchedPages.set(null);
- if (touchedPages != null)
- {
- for (int i = 0; i < touchedPages.size(); i++)
- {
- Page page = touchedPages.get(i);
- // page must be detached before it gets stored
- page.detach();
- page.getPageMap().put(page);
- dirty = true;
- }
- }
-
// If state is dirty
if (dirty)
{
@@ -1398,85 +869,6 @@
log.debug("update: Session not dirty.");
}
}
-
- List<IClusterable> dirtyObjects = Session.dirtyObjects.get();
- Session.dirtyObjects.set(null);
-
- Map<String, Object> tempMap = new HashMap<String, Object>();
-
- // Go through all dirty entries, replicating any dirty objects
- if (dirtyObjects != null)
- {
- for (final Iterator<IClusterable> iterator = dirtyObjects.iterator(); iterator.hasNext();)
- {
- String attribute = null;
- Object object = iterator.next();
- if (object instanceof Page)
- {
- final Page page = (Page)object;
- if (page.isPageStateless())
- {
- // check, can it be that stateless pages where added to
- // the session?
- // and should be removed now?
- continue;
- }
- attribute = page.getPageMap().attributeForId(page.getNumericId());
- if (getAttribute(attribute) == null)
- {
- // page removed by another thread. don't add it again.
- continue;
- }
- object = page.getPageMapEntry();
- }
- else if (object instanceof IPageMap)
- {
- attribute = attributeForPageMapName(((IPageMap)object).getName());
- }
-
- // we might override some attributes, so we use a temporary map
- // and then just copy the last values to real sesssion
- tempMap.put(attribute, object);
- }
- }
-
- // in case we have dirty attributes, set them to session
- if (tempMap.isEmpty() == false)
- {
- for (Entry<String, Object> entry : tempMap.entrySet())
- {
- // WICKET-NG this cast should not be necessary, map should be <string,serializable>
- setAttribute(entry.getKey(), (Serializable)entry.getValue());
- }
- }
-
- if (pageMapsUsedInRequest != null)
- {
- synchronized (pageMapsUsedInRequest)
- {
- Thread t = Thread.currentThread();
- Iterator<Entry<IPageMap, PageMapsUsedInRequestEntry>> it = pageMapsUsedInRequest.entrySet()
- .iterator();
- while (it.hasNext())
- {
- Entry<IPageMap, PageMapsUsedInRequestEntry> entry = it.next();
- if ((entry.getValue()).thread == t)
- {
- it.remove();
- }
- }
- pageMapsUsedInRequest.notifyAll();
- }
- }
- }
-
- /**
- *
- * @return the next page id
- */
- synchronized protected int nextPageId()
- {
- return pageIdCounter++;
}
/**
@@ -1488,4 +880,15 @@
{
return sequence++;
}
+
+ public synchronized int nextPageId()
+ {
+ return pageId++;
+ }
+
+ public PageManager getPageManager()
+ {
+ // TODO. Later page manager should be refactored to be session specific
+ return Application.get().getPageManager();
+ }
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/WebPage.java Thu Nov 12 23:36:57 2009
@@ -18,14 +18,10 @@
import org.apache.wicket.Application;
import org.apache.wicket.Component;
-import org.apache.wicket.IPageMap;
-import org.apache.wicket.IRequestTarget;
import org.apache.wicket.Page;
import org.apache.wicket.PageParameters;
-import org.apache.wicket.RequestCycle;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.Response;
-import org.apache.wicket.Session;
import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
@@ -35,11 +31,7 @@
import org.apache.wicket.protocol.http.WebResponse;
import org.apache.wicket.protocol.http.request.urlcompressing.UrlCompressingWebRequestProcessor;
import org.apache.wicket.protocol.http.request.urlcompressing.UrlCompressor;
-import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
-import org.apache.wicket.request.target.component.IBookmarkablePageRequestTarget;
import org.apache.wicket.response.StringResponse;
-import org.apache.wicket.util.lang.Objects;
-import org.apache.wicket.util.string.JavascriptUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -98,71 +90,10 @@
@Override
public final void renderHead(final IHeaderResponse headResponse)
{
- Response response = headResponse.getResponse();
- final WebRequestCycle cycle = (WebRequestCycle)RequestCycle.get();
- final IRequestTarget target = cycle.getRequestTarget();
-
- // we don't want to render this for stateless pages
- if (webPage.isPageStateless())
- {
- return;
- }
-
- IPageMap pageMap = webPage.getPageMap();
- String name = pageMap.getName();
- if (name == null)
- {
- name = "wicket:default";
- }
- else
- {
- name = name.replace('"', '_');
- }
-
- Session session = Session.get();
-
- Session.PageMapAccessMetaData meta = session.getMetaData(Session.PAGEMAP_ACCESS_MDK);
- if (meta == null)
- {
- meta = new Session.PageMapAccessMetaData();
- session.setMetaData(Session.PAGEMAP_ACCESS_MDK, meta);
- }
- boolean firstAccess = meta.add(pageMap);
-
- if (firstAccess)
- {
- // this is the first access to the pagemap, set window.name
- JavascriptUtils.writeOpenTag(response);
- response.write("if (window.name=='' || window.name.indexOf('wicket') > -1) { window.name=\"");
- response.write("wicket-" + name);
- response.write("\"; }");
- JavascriptUtils.writeCloseTag(response);
- }
- else
- {
- // Here is our trickery to detect whether the current request
- // was made in a new window/ tab, in which case it should go in
- // a different page map so that we don't intermingle the history
- // of those windows
- CharSequence url = null;
- if (target instanceof IBookmarkablePageRequestTarget)
- {
- IBookmarkablePageRequestTarget current = (IBookmarkablePageRequestTarget)target;
- BookmarkablePageRequestTarget redirect = new BookmarkablePageRequestTarget(
- current.getPageClass(), current.getPageParameters());
- url = cycle.urlFor(redirect);
- }
- else
- {
- url = webPage.urlFor(INewBrowserWindowListener.INTERFACE);
- }
- JavascriptUtils.writeOpenTag(response);
- response.write("if (window.name=='' || (window.name.indexOf('wicket') > -1 && window.name!='" +
- "wicket-" + name + "')) { window.location=\"");
- response.write(url);
- response.write("\" + (window.location.hash != null ? window.location.hash : \"\"); }");
- JavascriptUtils.writeCloseTag(response);
- }
+ // TODO
+ // this is the place where page checked for current pagemap name and cloned itself when
+ // opened in new tab.
+ // This will have to be done differently - as implementation detail of PageManager
}
}
@@ -195,24 +126,6 @@
}
/**
- * @see Page#Page(org.apache.wicket.IPageMap)
- */
- protected WebPage(final IPageMap pageMap)
- {
- super(pageMap);
- commonInit();
- }
-
- /**
- * @see Page#Page(org.apache.wicket.IPageMap, org.apache.wicket.model.IModel)
- */
- protected WebPage(final IPageMap pageMap, final IModel<?> model)
- {
- super(pageMap, model);
- commonInit();
- }
-
- /**
* Constructor which receives wrapped query string parameters for a request. Having this
* constructor public means that your page is 'bookmarkable' and hence can be called/ created
* from anywhere. For bookmarkable pages (as opposed to when you construct page instances
@@ -234,29 +147,6 @@
}
/**
- * Constructor which receives wrapped query string parameters for a request. Having this
- * constructor public means that your page is 'bookmarkable' and hence can be called/ created
- * from anywhere. For bookmarkable pages (as opposed to when you construct page instances
- * yourself, this constructor will be used in preference to a no-arg constructor, if both exist.
- * Note that nothing is done with the page parameters argument. This constructor is provided so
- * that tools such as IDEs will include it their list of suggested constructors for derived
- * classes.
- *
- * Please call this constructor (or the one without the pagemap) if you want to remember the
- * pageparameters {@link #getPageParameters()}. So that they are reused for stateless links.
- *
- * @param pageMap
- * The pagemap where the webpage needs to be constructed in.
- * @param parameters
- * Wrapped query string parameters.
- */
- protected WebPage(final IPageMap pageMap, final PageParameters parameters)
- {
- super(pageMap, parameters);
- commonInit();
- }
-
- /**
* Gets the markup type for a WebPage, which is "html" by default. Support for pages in another
* markup language, such as VXML, would require the creation of a different Page subclass in an
* appropriate package under org.apache.wicket.markup. To support VXML (voice markup), one might
@@ -302,19 +192,7 @@
*/
public void onNewBrowserWindow()
{
- // if the browser reports a history of 0 then make a new webpage
- WebPage clonedPage = this;
- try
- {
- clonedPage = (WebPage)Objects.cloneObject(this);
- }
- catch (Exception e)
- {
- log.error("Page " + clonedPage + " couldn't be cloned to move to another pagemap", e);
- }
- final IPageMap map = getSession().createAutoPageMap();
- clonedPage.moveToPageMap(map);
- setResponsePage(clonedPage);
+ // TODO: Needs to be implementation detail of PageManager
}
/**
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupCloseLink.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupCloseLink.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupCloseLink.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupCloseLink.java Thu Nov 12 23:36:57 2009
@@ -65,9 +65,6 @@
@Override
public void onClick()
{
- // Remove the popup's page map from the session
- getPage().getPageMap().remove();
-
// Web page closes window using javascript code in PopupCloseLink$1.html
setResponsePage(ClosePopupPage.class);
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/link/PopupSettings.java Thu Nov 12 23:36:57 2009
@@ -17,7 +17,6 @@
package org.apache.wicket.markup.html.link;
import org.apache.wicket.IClusterable;
-import org.apache.wicket.PageMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java Thu Nov 12 23:36:57 2009
@@ -22,9 +22,7 @@
import javax.servlet.http.HttpSession;
-import org.apache.wicket.AccessStackPageMap;
import org.apache.wicket.Application;
-import org.apache.wicket.IPageMap;
import org.apache.wicket.Request;
import org.apache.wicket.Session;
@@ -49,14 +47,6 @@
}
/**
- * @see org.apache.wicket.session.ISessionStore#createPageMap(java.lang.String)
- */
- public IPageMap createPageMap(String name)
- {
- return new AccessStackPageMap(name);
- }
-
- /**
* @see org.apache.wicket.session.ISessionStore#getAttribute(org.apache.wicket.Request,
* java.lang.String)
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Thu Nov 12 23:36:57 2009
@@ -38,7 +38,6 @@
import org.apache.wicket.markup.html.pages.InternalErrorPage;
import org.apache.wicket.markup.html.pages.PageExpiredErrorPage;
import org.apache.wicket.markup.resolver.AutoLinkResolver;
-import org.apache.wicket.protocol.http.pagestore.DiskPageStore;
import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
import org.apache.wicket.request.IRequestCycleProcessor;
import org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy;
@@ -599,7 +598,7 @@
@Override
protected ISessionStore newSessionStore()
{
- return new SecondLevelCacheSessionStore(this, new DiskPageStore());
+ return new HttpSessionStore(this);
}
/**
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java Thu Nov 12 23:36:57 2009
@@ -253,7 +253,7 @@
// Always touch the page again so that a redirect listener makes a page
// stateful and adds it to the pagemap
- getSession().touch(page);
+ getSession().getPageManager().touchPage(page);
// Redirect to the url for the page
response.redirect(redirectUrl);
@@ -274,7 +274,7 @@
// doing that now and redirect
session.setMetaData(BROWSER_WAS_POLLED_KEY, Boolean.TRUE);
String url = "/" + getRequest().getURL();
- throw new RestartResponseException(newBrowserInfoPage(url));
+ throw new RestartResponseException(newBrowserInfoPage(url));
}
// if we get here, the redirect already has been done; clear
// the meta data entry; we don't need it any longer is the client
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycleProcessor.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycleProcessor.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycleProcessor.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycleProcessor.java Thu Nov 12 23:36:57 2009
@@ -18,17 +18,12 @@
import javax.servlet.http.HttpServletResponse;
-import org.apache.wicket.AccessStackPageMap;
import org.apache.wicket.Application;
-import org.apache.wicket.Component;
-import org.apache.wicket.IPageMap;
import org.apache.wicket.IRequestTarget;
-import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.Session;
import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.AccessStackPageMap.Access;
import org.apache.wicket.protocol.http.request.InvalidUrlException;
import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
import org.apache.wicket.protocol.http.servlet.AbortWithWebErrorCodeException;
@@ -83,60 +78,6 @@
// marks whether or not we will be processing this request
int processRequest = 0; // 0 == process, 1 == page expired, 2 == not active page
// anymore
- synchronized (requestCycle.getSession())
- {
- // we need to check if this request has been flagged as
- // process-only-if-path-is-active and if so make sure this
- // condition is met
- if (requestParameters.isOnlyProcessIfPathActive())
- {
- // this request has indeed been flagged as
- // process-only-if-path-is-active
-
- Session session = Session.get();
- IPageMap pageMap = session.pageMapForName(
- requestParameters.getPageMapName(), false);
- if (pageMap == null)
- {
- // requested pagemap no longer exists - ignore this
- // request
- processRequest = 1;
- }
- else if (pageMap instanceof AccessStackPageMap)
- {
- AccessStackPageMap accessStackPageMap = (AccessStackPageMap)pageMap;
- if (accessStackPageMap.getAccessStack().size() > 0)
- {
- final Access access = accessStackPageMap.getAccessStack().peek();
-
- final int pageId = Integer.parseInt(Strings.firstPathComponent(
- requestParameters.getComponentPath(), Component.PATH_SEPARATOR));
-
- if (pageId != access.getId())
- {
- // the page is no longer the active page
- // - ignore this request
- processRequest = 2;
- }
- else
- {
- final int version = requestParameters.getVersionNumber();
- if (version != Page.LATEST_VERSION &&
- version != access.getVersion())
- {
- // version is no longer the active version -
- // ignore this request
- processRequest = 2;
- }
- }
- }
- }
- else
- {
- // TODO also this should work..
- }
- }
- }
if (processRequest == 0)
{
try
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Thu Nov 12 23:36:57 2009
@@ -26,12 +26,10 @@
import org.apache.wicket.Application;
import org.apache.wicket.Component;
-import org.apache.wicket.IPageMap;
import org.apache.wicket.IRedirectListener;
import org.apache.wicket.IRequestTarget;
import org.apache.wicket.IResourceListener;
import org.apache.wicket.Page;
-import org.apache.wicket.PageMap;
import org.apache.wicket.PageParameters;
import org.apache.wicket.PageReference;
import org.apache.wicket.Request;
@@ -58,7 +56,6 @@
import org.apache.wicket.request.target.component.PageReferenceRequestTarget;
import org.apache.wicket.request.target.component.listener.IListenerInterfaceRequestTarget;
import org.apache.wicket.request.target.resource.ISharedResourceRequestTarget;
-import org.apache.wicket.util.lang.Objects;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.string.PrependingStringBuffer;
import org.apache.wicket.util.string.Strings;
@@ -555,10 +552,6 @@
requestString + ", expected: 'pageMapName:pageClassName'");
}
- // Extract any pagemap name
- final String pageMapName = components[0];
- parameters.setPageMapName(pageMapName.length() == 0 ? PageMap.DEFAULT_NAME
- : pageMapName);
// Extract bookmarkable page class name
final String pageClassName = components[1];
@@ -632,7 +625,6 @@
// Set pagemap name
final String pageMapName = pathComponents[0];
- parameters.setPageMapName(pageMapName.length() == 0 ? PageMap.DEFAULT_NAME : pageMapName);
// Extract URL depth after last colon
final String urlDepthString = pathComponents[pathComponents.length - 1];
@@ -754,15 +746,7 @@
if (currentTarget instanceof IPageRequestTarget)
{
Page currentPage = ((IPageRequestTarget)currentTarget).getPage();
- final IPageMap pageMap = currentPage.getPageMap();
- if (pageMap.isDefault())
- {
- pageMapName = "";
- }
- else
- {
- pageMapName = pageMap.getName();
- }
+ pageMapName = "";
}
else
{
@@ -880,18 +864,14 @@
url.append('=');
// add pagemap
- if (!Objects.equal(PageMap.DEFAULT_NAME, id.getPageMapName()))
- {
- url.append(id.getPageMapName());
- }
url.append(Component.PATH_SEPARATOR);
// add page id
- url.append(id.getPageNumber());
+ url.append(id.getPageId());
url.append(Component.PATH_SEPARATOR);
// add version
- url.append(id.getPageVersion());
+ url.append(0);
url.append(Component.PATH_SEPARATOR);
// add listener interface (noop because we default to redirect listener which is default)
@@ -932,11 +912,6 @@
final Page page = component.getPage();
// Add pagemap
- final IPageMap pageMap = page.getPageMap();
- if (!pageMap.isDefault())
- {
- url.append(pageMap.getName());
- }
url.append(Component.PATH_SEPARATOR);
// Add path to component
@@ -1005,7 +980,8 @@
// Touch the page once because it could be that it did go from stateless
// to stateful or it was a internally made page where just a url must
// be made for (frames)
- Session.get().touch(page);
+
+ Session.get().getPageManager().touchPage(page);
return urlRedirect;
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/urlcompressing/UrlCompressingWebCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/urlcompressing/UrlCompressingWebCodingStrategy.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/urlcompressing/UrlCompressingWebCodingStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/urlcompressing/UrlCompressingWebCodingStrategy.java Thu Nov 12 23:36:57 2009
@@ -17,7 +17,6 @@
package org.apache.wicket.protocol.http.request.urlcompressing;
import org.apache.wicket.Component;
-import org.apache.wicket.IPageMap;
import org.apache.wicket.IRedirectListener;
import org.apache.wicket.Page;
import org.apache.wicket.RequestCycle;
@@ -78,12 +77,6 @@
final Component component = requestTarget.getTarget();
final Page page = component.getPage();
- // Add pagemap
- final IPageMap pageMap = page.getPageMap();
- if (!pageMap.isDefault())
- {
- url.append(pageMap.getName());
- }
url.append(Component.PATH_SEPARATOR);
String listenerName = rli.getName();
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java?rev=835641&r1=835640&r2=835641&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java Thu Nov 12 23:36:57 2009
@@ -258,8 +258,9 @@
{
// try to retrieve an existing page
final String componentPath = requestParameters.getComponentPath();
- final Page page = session.getPage(requestParameters.getPageMapName(),
- componentPath, requestParameters.getVersionNumber());
+ final String id = Strings.firstPathComponent(componentPath,
+ Component.PATH_SEPARATOR);
+ final Page page = (Page)session.getPageManager().getPage(Integer.valueOf(id));
if (page != null && page.getClass() == pageClass)
{
@@ -454,8 +455,8 @@
{
final String componentPath = requestParameters.getComponentPath();
final Session session = requestCycle.getSession();
- final Page page = session.getPage(requestParameters.getPageMapName(), componentPath,
- requestParameters.getVersionNumber());
+ final String id = Strings.firstPathComponent(componentPath, Component.PATH_SEPARATOR);
+ final Page page = (Page)session.getPageManager().getPage(Integer.valueOf(id));
// Does page exist?
if (page != null)