Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x e493b0435 -> 7b239ca45


WICKET-6295 fallback to home page
a previous request might have consumed the original destination - this could 
happen if the meta refresh fires but the user is still able to link on the link


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7b239ca4
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7b239ca4
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7b239ca4

Branch: refs/heads/wicket-6.x
Commit: 7b239ca45a876a9b90da6e90001bcbb36578574b
Parents: e493b04
Author: Sven Meier <svenme...@apache.org>
Authored: Thu Dec 8 16:29:29 2016 +0100
Committer: Sven Meier <svenme...@apache.org>
Committed: Thu Dec 8 16:29:29 2016 +0100

----------------------------------------------------------------------
 .../markup/html/pages/BrowserInfoPage.java      | 24 ++++++++------------
 1 file changed, 9 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/7b239ca4/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
index 373cbb5..507cd9e 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
@@ -25,14 +25,12 @@ import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.model.AbstractReadOnlyModel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.protocol.http.ClientProperties;
 import org.apache.wicket.protocol.http.WebSession;
 import org.apache.wicket.protocol.http.request.WebClientInfo;
 import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.settings.IRequestCycleSettings;
 
 /**
- * <p>
  * This page uses a form post right after the page has loaded in the browser, 
using JavaScript or
  * alternative means to detect and pass on settings to the embedded form. The 
form submit method
  * updates this session's {@link org.apache.wicket.core.request.ClientInfo} 
object and then redirects to
@@ -53,28 +51,24 @@ public class BrowserInfoPage extends WebPage
        private BrowserInfoForm browserInfoForm;
 
        /**
-        * Bookmarkable constructor. This is not for normal framework client 
use. It will be called
-        * whenever JavaScript is not supported, and the browser info page's 
meta refresh fires to this
-        * page. Prior to this, the other constructor should already have been 
called.
+        * This constructor will be called twice, once to display the initial 
page and additionally when JavaScript
+        * is not enabled and the meta refresh fires or the user clicks the 
link instead.
         */
        public BrowserInfoPage()
        {
                initComps();
                RequestCycle requestCycle = getRequestCycle();
                WebSession session = (WebSession)getSession();
+
                WebClientInfo clientInfo = session.getClientInfo();
-               if (clientInfo == null)
+               if (clientInfo != null)
                {
-                       clientInfo = new WebClientInfo(requestCycle);
-                       getSession().setClientInfo(clientInfo);
+                       // clientInfo is already present so continue
+                       continueToOriginalDestination();
+                       
+                       // switch to home page if no original destination was 
intercepted
+                       setResponsePage(getApplication().getHomePage());
                }
-               else
-               {
-                       ClientProperties properties = 
clientInfo.getProperties();
-                       properties.setJavaEnabled(false);
-               }
-
-               continueToOriginalDestination();
        }
 
        @Override

Reply via email to