You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2017/01/25 20:45:13 UTC

[1/3] wicket git commit: Russian sign out page is added

Repository: wicket
Updated Branches:
  refs/heads/master c4805d870 -> f380ea700


Russian sign out page is added


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

Branch: refs/heads/master
Commit: ef66df872de4314b524b7e83943113f5c23642a7
Parents: f7a6690
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Mon Jan 23 22:09:25 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Mon Jan 23 22:09:25 2017 +0700

----------------------------------------------------------------------
 .../authentication/pages/SignOutPage_ru.html    | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ef66df87/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/pages/SignOutPage_ru.html
----------------------------------------------------------------------
diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/pages/SignOutPage_ru.html b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/pages/SignOutPage_ru.html
new file mode 100644
index 0000000..59cbbcb
--- /dev/null
+++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/pages/SignOutPage_ru.html
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<html>
+<head>
+    <title>\u0412\u044b\u0445\u043e\u0434</title>
+</head>
+<body>
+	<h2>\u0414\u043e \u0441\u0432\u0438\u0434\u0430\u043d\u0438\u044f!</h2>	
+</body>
+</html>


[3/3] wicket git commit: Merge branch 'pr-206-master'

Posted by mg...@apache.org.
Merge branch 'pr-206-master'


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

Branch: refs/heads/master
Commit: f380ea700427881bb82f356d1d7cb3a05cdfcaab
Parents: c4805d8 8b3e7d4
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jan 25 21:44:56 2017 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jan 25 21:44:56 2017 +0100

----------------------------------------------------------------------
 .../authentication/pages/SignOutPage_ru.html    | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------



[2/3] wicket git commit: WICKET-6288 testing if the page if expired using IPageProvider API

Posted by mg...@apache.org.
WICKET-6288 testing if the page if expired using IPageProvider API


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

Branch: refs/heads/master
Commit: 8b3e7d42202e6ccaa0d0bc2bfe4dabf87ffe03db
Parents: ef66df8
Author: Pedro Henrique Oliveira dos Santos <pe...@apache.org>
Authored: Wed Jan 25 04:03:19 2017 -0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jan 25 21:41:55 2017 +0100

----------------------------------------------------------------------
 .../core/request/handler/IPageProvider.java     |  7 +++
 .../ListenerInterfaceRequestHandler.java        | 21 ++++----
 .../core/request/handler/PageProvider.java      |  9 ++++
 .../ListenerInterfaceRequestHandlerTest.java    | 55 ++++++++++++++++++++
 4 files changed, 80 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/8b3e7d42/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPageProvider.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPageProvider.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPageProvider.java
index 617eb81..90fdaf8 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPageProvider.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPageProvider.java
@@ -62,6 +62,13 @@ public interface IPageProvider
 	boolean isNewPageInstance();
 
 	/**
+	 * Returns whether the provided page was expired prior to this access.
+	 *
+	 * @return <code>true></code> if the page was created after its original instance expired.
+	 */
+	boolean wasExpired();
+
+	/**
 	 * Returns class of the page.
 	 *
 	 * @return page class

http://git-wip-us.apache.org/repos/asf/wicket/blob/8b3e7d42/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
index 4cb54ee..c976a42 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandler.java
@@ -167,28 +167,25 @@ public class ListenerInterfaceRequestHandler
 			// initialize the page to be able to check whether it is stateless
 			((Page)page).internalInitialize();
 		}
-		final boolean isStateless = page.isPageStateless();
 
-		RedirectPolicy policy = isStateless
+		RedirectPolicy policy = page.isPageStateless()
 			? RedirectPolicy.NEVER_REDIRECT
 			: RedirectPolicy.AUTO_REDIRECT;
 
-		final boolean canCallListenerInterfaceAfterExpiry = component != null && component.canCallListenerInterfaceAfterExpiry();
+		boolean blockIfExpired = component != null && !component.canCallListenerInterfaceAfterExpiry();
 
-		if (!canCallListenerInterfaceAfterExpiry && freshPage && (isStateless == false || component == null))
-		{
-			// A request listener is invoked on an expired page.
+		boolean lateComponent = component == null && freshPage;
 
-			// If the page is stateful then we cannot assume that the listener is
-			// invoked on its initial state (right after page initialization) and that its
-			// component and/or behavior will be available. That's why the listener
-			// should be ignored and the best we can do is to re-paint the newly constructed
-			// page.
+		if ((pageComponentProvider.wasExpired() && blockIfExpired) || lateComponent)
+		{
+			// A request listener is invoked on an expired page or the component couldn't be
+			// determined. The best we can do is to re-paint the newly constructed page.
+			// Reference: WICKET-4454, WICKET-6288
 
 			if (LOG.isDebugEnabled())
 			{
 				LOG.debug(
-					"An IRequestListener on '{}' is executed on an expired stateful page. "
+					"An IRequestListener was called but its page/component({}) couldn't be resolved. "
 						+ "Scheduling re-create of the page and ignoring the listener interface...",
 					getComponentPath());
 			}

http://git-wip-us.apache.org/repos/asf/wicket/blob/8b3e7d42/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java
index 0d262d1..e5e1a01 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java
@@ -220,6 +220,15 @@ public class PageProvider implements IPageProvider, IClusterable
 	}
 
 	/**
+	 * @see org.apache.wicket.core.request.handler.IPageProvider#wasExpired()
+	 */
+	@Override
+	public boolean wasExpired()
+	{
+		return pageId != null && isPageInstanceFresh();
+	}
+
+	/**
 	 * @see IPageProvider#getPageClass()
 	 */
 	@Override

http://git-wip-us.apache.org/repos/asf/wicket/blob/8b3e7d42/wicket-core/src/test/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandlerTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandlerTest.java b/wicket-core/src/test/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandlerTest.java
index 930bec3..d1c0592 100644
--- a/wicket-core/src/test/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandlerTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/core/request/handler/ListenerInterfaceRequestHandlerTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.wicket.core.request.handler;
 
+import static org.hamcrest.Matchers.is;
+
 import java.io.IOException;
 import java.text.ParseException;
 
@@ -25,9 +27,15 @@ import org.apache.wicket.Session;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.core.request.mapper.MountedMapper;
+import org.apache.wicket.markup.IMarkupFragment;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
+import org.apache.wicket.markup.Markup;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.link.StatelessLink;
 import org.apache.wicket.request.Url;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.resource.DummyPage;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.ResourceStreamNotFoundException;
@@ -150,4 +158,51 @@ public class ListenerInterfaceRequestHandlerTest extends WicketTestCase
 		assertFalse("Handler should not report a page instance is available ",
 			handler.isPageInstanceCreated());
 	}
+
+	@Test
+	public void skipListenerIfExpiredPage()
+	{
+		tester.getApplication().getRootRequestMapperAsCompound() .add(new MountedMapper("/segment", NotExpiredPage.class));
+		tester.startPage(NotExpiredPage.class);
+		tester.clickLink("statelessLink");
+		NotExpiredPage page = (NotExpiredPage)tester.getLastRenderedPage();
+		assertThat(page.invoked, is(true));
+	}
+
+	public static class NotExpiredPage extends WebPage
+	{
+		public boolean invoked;
+
+		public NotExpiredPage(PageParameters pageParameters)
+		{
+			super(pageParameters);
+			add(new StatelessLink<Object>("statelessLink")
+			{
+				public void onClick()
+				{
+					invoked = true;
+				}
+			});
+			add(new Link<Object>("statefullLink")
+			{
+				public void onClick()
+				{
+				}
+			});
+		}
+
+		@Override
+		public IMarkupFragment getMarkup()
+		{
+			return Markup.of(
+				"<html><body><a wicket:id=\"statelessLink\"></a><a wicket:id=\"statefullLink\"></a></body></html>");
+		}
+
+		@Override
+		protected void onBeforeRender()
+		{
+			get("statefullLink").setVisible(false);
+			super.onBeforeRender();
+		}
+	}
 }