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 2016/07/19 22:14:37 UTC

[1/6] wicket git commit: WICKET-6206 Allow overriding of addAntiCacheParameter

Repository: wicket
Updated Branches:
  refs/heads/master 403db7550 -> dae680cf9


WICKET-6206 Allow overriding of addAntiCacheParameter

...in class Image, so that one can define precisely
how to generate the anticache parameter value.


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

Branch: refs/heads/master
Commit: b29d2617e2bc996b74e1b959e7c8fb73caaba6ee
Parents: 0ff4617
Author: Yoann Rodi�re <yo...@openwide.fr>
Authored: Mon Jul 18 12:43:55 2016 +0200
Committer: Yoann Rodi�re <yo...@openwide.fr>
Committed: Mon Jul 18 12:43:55 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/wicket/markup/html/image/Image.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/b29d2617/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
index 7aa9b85..5bcfdef 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/image/Image.java
@@ -548,7 +548,7 @@ public class Image extends WebComponent implements IRequestListener
 	 * 
 	 * @param tag
 	 */
-	protected final void addAntiCacheParameter(final ComponentTag tag)
+	protected void addAntiCacheParameter(final ComponentTag tag)
 	{
 		String url = tag.getAttributes().getString("src");
 		url = url + (url.contains("?") ? "&" : "?");


[6/6] wicket git commit: Merge branch 'pr-175-WICKET-6206'

Posted by mg...@apache.org.
Merge branch 'pr-175-WICKET-6206'


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

Branch: refs/heads/master
Commit: dae680cf94cd0d820bcc32029f7ba24f205d010f
Parents: 403db75 4054dbc
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jul 20 00:14:02 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jul 20 00:14:02 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/wicket/markup/html/image/Image.java   | 2 +-
 .../org/apache/wicket/markup/html/form/PasswordTextFieldTest.java  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[2/6] wicket git commit: WICKET-6211 clear password on detach

Posted by mg...@apache.org.
WICKET-6211 clear password on detach


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

Branch: refs/heads/master
Commit: 4054dbc7f8839a9b6dfee1fcdfc9afe4370724ce
Parents: b93e1ba
Author: Sven Meier <sv...@apache.org>
Authored: Tue Jul 19 23:50:17 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jul 20 00:10:32 2016 +0200

----------------------------------------------------------------------
 .../markup/html/form/PasswordTextField.java     | 50 ++++++----
 .../markup/html/form/PasswordTextFieldTest.java | 97 ++++++++++++++++++++
 2 files changed, 129 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/4054dbc7/wicket-core/src/main/java/org/apache/wicket/markup/html/form/PasswordTextField.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/PasswordTextField.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/PasswordTextField.java
index cbb5010..334248c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/PasswordTextField.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/PasswordTextField.java
@@ -18,8 +18,6 @@ package org.apache.wicket.markup.html.form;
 
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.model.IModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -28,6 +26,10 @@ import org.slf4j.LoggerFactory;
  * <p>
  * By default this text field is required. If it is not, call {@link #setRequired(boolean)} with
  * value of <code>false</code>.
+ * <p>
+ * Note that by default the model object is nullified after each request to prevent the entered
+ * password to be serialized along with the containing page, see {@link #setResetPassword(boolean)}
+ * for details.
  * 
  * @author Jonathan Locke
  */
@@ -35,14 +37,8 @@ public class PasswordTextField extends TextField<String>
 {
 	private static final long serialVersionUID = 1L;
 
-	/** Log. */
-	private static final Logger log = LoggerFactory.getLogger(PasswordTextField.class);
-
 	/**
-	 * Flag indicating whether the contents of the field should be reset each time it is rendered.
-	 * If <code>true</code>, the contents are emptied when the field is rendered. This is useful for
-	 * login forms. If <code>false</code>, the contents of the model are put into the field. This is
-	 * useful for entry forms where the contents of the model should be editable, or resubmitted.
+	 * Should password be reset, see {@link #setResetPassword(boolean)}.
 	 */
 	private boolean resetPassword = true;
 
@@ -67,12 +63,9 @@ public class PasswordTextField extends TextField<String>
 	}
 
 	/**
-	 * Flag indicating whether the contents of the field should be reset each time it is rendered.
-	 * If <code>true</code>, the contents are emptied when the field is rendered. This is useful for
-	 * login forms. If <code>false</code>, the contents of the model are put into the field. This is
-	 * useful for entry forms where the contents of the model should be editable, or resubmitted.
+	 * Should password be reset, see {@link #setResetPassword(boolean)}.
 	 * 
-	 * @return Returns the resetPassword.
+	 * @return should password be resetted
 	 */
 	public final boolean getResetPassword()
 	{
@@ -80,10 +73,14 @@ public class PasswordTextField extends TextField<String>
 	}
 
 	/**
-	 * Flag indicating whether the contents of the field should be reset each time it is rendered.
-	 * If <code>true</code>, the contents are emptied when the field is rendered. This is useful for
-	 * login forms. If <code>false</code>, the contents of the model are put into the field. This is
-	 * useful for entry forms where the contents of the model should be editable, or resubmitted.
+	 * Flag indicating whether the password should be reset after each request.
+	 * Additionally any present value is not rendered into the markup.
+	 * <br>
+	 * If <code>true</code>, the model object is set to null after each request to prevent it
+	 * being serialized along with the containing page. This is default and highly recommended
+	 * for login forms. If <code>false</code> the model value is handled as in a standard
+	 * {@link TextField}, this is useful for entry forms where the contents of the model should
+	 * be editable, or resubmitted.
 	 * 
 	 * @param resetPassword
 	 *            The resetPassword to set.
@@ -117,4 +114,21 @@ public class PasswordTextField extends TextField<String>
 	{
 		return new String[] {"password"};
 	}
+
+	/**
+	 * Overriden to nullify the password.
+	 */
+	@Override
+	protected void onDetach()
+	{
+		if (resetPassword) {
+			clearInput();
+
+			if (getModel() != null) {
+				setModelObject(null);
+			}
+		}
+
+		super.onDetach();
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/4054dbc7/wicket-core/src/test/java/org/apache/wicket/markup/html/form/PasswordTextFieldTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/PasswordTextFieldTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/PasswordTextFieldTest.java
new file mode 100644
index 0000000..9b93fcc
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/PasswordTextFieldTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+package org.apache.wicket.markup.html.form;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.util.tester.WicketTestCase;
+import org.junit.Test;
+
+/**
+ * Test for {@link PasswordTextField}.
+ *
+ * @author svenmeier
+ */
+public class PasswordTextFieldTest extends WicketTestCase
+{
+
+	@Test
+	public void nullifyPassword()
+	{
+		TestModel model = new TestModel();
+
+		PasswordTextField field = new PasswordTextField("password", model);
+
+		field.detach();
+
+		assertNull(model.password);
+		assertTrue(model.detached);
+	}
+
+	@Test
+	public void nullifyPasswordOnNullModel()
+	{
+		PasswordTextField field = new PasswordTextField("password");
+		field.setVisible(false);
+
+		// does nothing on null model
+		field.detach();
+	}
+
+
+	@Test
+	public void nullifyNoReset()
+	{
+		TestModel model = new TestModel();
+
+		PasswordTextField field = new PasswordTextField("password", model);
+		field.setResetPassword(false);
+
+		field.detach();
+
+		assertEquals("test", model.password);
+		assertTrue(model.detached);
+	}
+
+	private class TestModel implements IModel<String>
+	{
+		public boolean detached;
+
+		public String password = "test";
+
+		@Override
+		public String getObject()
+		{
+			detached = false;
+
+			return password;
+		}
+
+		@Override
+		public void setObject(String password)
+		{
+			this.password = password;
+
+			detached = false;
+		}
+
+		@Override
+		public void detach()
+		{
+			detached = true;
+		}
+	}
+}


[5/6] wicket git commit: Update maven-bundle-plugin to 3.2.0

Posted by mg...@apache.org.
Update maven-bundle-plugin to 3.2.0


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

Branch: refs/heads/master
Commit: 0d8ab849b4b9dd08337dc4a9b818b741fa7a63e4
Parents: ed69f1d
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jul 18 22:52:20 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jul 20 00:10:32 2016 +0200

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/0d8ab849/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bf21120..f2a92fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -733,7 +733,7 @@
 				<plugin>
 					<groupId>org.apache.felix</groupId>
 					<artifactId>maven-bundle-plugin</artifactId>
-					<version>3.0.0</version>
+					<version>3.2.0</version>
 					<executions>
 						<execution>
 							<id>bundle-manifest</id>


[4/6] wicket git commit: category SlowTests for all tests needing a network connection

Posted by mg...@apache.org.
category SlowTests for all tests needing a network connection


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

Branch: refs/heads/master
Commit: ed69f1dfdfb2a9f2b3eb46bedbca842f6c8a64ee
Parents: b29d261
Author: Sven Meier <sv...@apache.org>
Authored: Mon Jul 18 21:46:13 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jul 20 00:10:32 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/wicket/protocol/http/WicketFilterTest.java   | 4 ++++
 .../src/test/java/org/apache/wicket/util/io/ConnectionsTest.java | 3 +++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ed69f1df/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketFilterTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketFilterTest.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketFilterTest.java
index 7fc36a7..f0560b0 100644
--- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketFilterTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/protocol/http/WicketFilterTest.java
@@ -55,12 +55,14 @@ import org.apache.wicket.request.http.WebRequest;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.DynamicImageResource;
 import org.apache.wicket.request.resource.IResource;
+import org.apache.wicket.util.SlowTests;
 import org.apache.wicket.util.file.WebXmlFile;
 import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.tester.DummyHomePage;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
@@ -126,6 +128,7 @@ public class WicketFilterTest extends Assert
 	 * testFilterPath1()
 	 */
 	@Test
+	@Category(SlowTests.class)
 	public void filterPath1()
 	{
 		InputStream in = WicketFilterTest.class.getResourceAsStream("web1.xml");
@@ -137,6 +140,7 @@ public class WicketFilterTest extends Assert
 	 * testFilterPath2()
 	 */
 	@Test
+	@Category(SlowTests.class)
 	public void filterPath2()
 	{
 		InputStream in = WicketFilterTest.class.getResourceAsStream("web2.xml");

http://git-wip-us.apache.org/repos/asf/wicket/blob/ed69f1df/wicket-util/src/test/java/org/apache/wicket/util/io/ConnectionsTest.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/test/java/org/apache/wicket/util/io/ConnectionsTest.java b/wicket-util/src/test/java/org/apache/wicket/util/io/ConnectionsTest.java
index b5e994f..ef95539 100644
--- a/wicket-util/src/test/java/org/apache/wicket/util/io/ConnectionsTest.java
+++ b/wicket-util/src/test/java/org/apache/wicket/util/io/ConnectionsTest.java
@@ -23,10 +23,13 @@ import static org.hamcrest.CoreMatchers.notNullValue;
 
 import java.net.URL;
 
+import org.apache.wicket.util.SlowTests;
 import org.apache.wicket.util.time.Time;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 @SuppressWarnings("javadoc")
+@Category(SlowTests.class)
 public class ConnectionsTest 
 {
 	/**


[3/6] wicket git commit: WICKET-6209 move try-catch into function which is invoked via #setTimeout(), so IE errors get caught

Posted by mg...@apache.org.
WICKET-6209 move try-catch into function which is invoked via #setTimeout(), so IE errors get caught

;removed workaround for WicketWICKET-5755, i.e. directly call #requestFocus() since it now always uses #setTimeout() to request focus (see WICKET-5858)


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

Branch: refs/heads/master
Commit: b93e1ba557f85cdbf77fd44a14721918feb23910
Parents: 0d8ab84
Author: Sven Meier <sv...@apache.org>
Authored: Tue Jul 19 22:47:15 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jul 20 00:10:32 2016 +0200

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js    | 47 +++++++++-----------
 1 file changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/b93e1ba5/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index a7aa0d9..f0c5c12 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -1098,13 +1098,7 @@
 				this._executeHandlers(attrs.sh, attrs, null, null, 'success');
 				Wicket.Event.publish(Wicket.Event.Topic.AJAX_CALL_SUCCESS, attrs, null, null, 'success');
 
-				// set the focus to the last component
-				if (Wicket.Browser.isIELessThan9()) {
-					// WICKET-5755
-					window.setTimeout("Wicket.Focus.requestFocus();", 0);
-				} else {
-					Wicket.Focus.requestFocus();
-				}
+				Wicket.Focus.requestFocus();
 
 				// continue to next step (which should make the processing stop, as success should be the final step)
 				return FunctionsExecuter.DONE;
@@ -2702,30 +2696,33 @@
 
 					if (toFocus) {
 						Wicket.Log.info("Calling focus on " + WF.lastFocusId);
-						try {
-							if (WF.focusSetFromServer) {
-								// WICKET-5858
-								window.setTimeout(function () { toFocus.focus(); }, 0);
-							} else {
-								// avoid loops like - onfocus triggering an event the modifies the tag => refocus => the event is triggered again
-								var temp = toFocus.onfocus;
-								toFocus.onfocus = null;
-								
-								// IE needs setTimeout (it seems not to call onfocus sync. when focus() is called
-								window.setTimeout(function () {toFocus.focus(); toFocus.onfocus = temp; }, 0);
+
+						var safeFocus = function() {
+							try {
+								toFocus.focus();
+							} catch (ignore) {
+								// WICKET-6209 IE fails if toFocus is disabled
 							}
-						} catch (ignore) {
+						};
+
+						if (WF.focusSetFromServer) {
+							// WICKET-5858
+							window.setTimeout(safeFocus, 0);
+						} else {
+							// avoid loops like - onfocus triggering an event the modifies the tag => refocus => the event is triggered again
+							var temp = toFocus.onfocus;
+							toFocus.onfocus = null;
+
+							// IE needs setTimeout (it seems not to call onfocus sync. when focus() is called
+							window.setTimeout(function () { safeFocus(); toFocus.onfocus = temp; }, 0);
 						}
-					}
-					else {
+					} else {
 						WF.lastFocusId = "";
 						Wicket.Log.info("Couldn't set focus on element with id '" + WF.lastFocusId + "' because it is not in the page anymore");
 					}
-				}
-				else if (WF.refocusLastFocusedComponentAfterResponse) {
+				} else if (WF.refocusLastFocusedComponentAfterResponse) {
 					Wicket.Log.info("last focus id was not set");
-				}
-				else {
+				} else {
 					Wicket.Log.info("refocus last focused component not needed/allowed");
 				}
 				Wicket.Focus.refocusLastFocusedComponentAfterResponse = false;