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 2014/06/04 21:28:35 UTC

[1/4] git commit: Update ResourceStreamLocator's javadoc to use the resource reference variation too

Repository: wicket
Updated Branches:
  refs/heads/master 95c110490 -> a82389b81


Update ResourceStreamLocator's javadoc to use the resource reference variation too

(cherry picked from commit 84d49a08ea8febec6935ab49e8d1ff2986a9af4d)


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

Branch: refs/heads/master
Commit: d66d2e3a4f2f2e5cff7721ab2e44a72c7b018a2e
Parents: 62f5bec
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jun 2 09:42:51 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 4 20:04:05 2014 +0200

----------------------------------------------------------------------
 .../resource/locator/ResourceStreamLocator.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/d66d2e3a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
index 1c1f71f..c555873 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ResourceStreamLocator.java
@@ -35,18 +35,20 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * Locate Wicket resource.
+ * Locates Wicket resources.
+ *
  * <p>
- * Contains the logic to locate a resource based on a path, a style (see
+ * Contains the logic to locate a resource based on a path, a variation, a style (see
  * {@link org.apache.wicket.Session}), a locale and an extension string. The full filename will be
- * built like: &lt;path&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;.
+ * built like: &lt;path&gt;_&lt;variation&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;.
  * <p>
  * Resource matches will be attempted in the following order:
  * <ol>
- * <li>1. &lt;path&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;</li>
- * <li>2. &lt;path&gt;_&lt;locale&gt;.&lt;extension&gt;</li>
- * <li>3. &lt;path&gt;_&lt;style&gt;.&lt;extension&gt;</li>
- * <li>4. &lt;path&gt;.&lt;extension&gt;</li>
+ * <li>&lt;path&gt;_&lt;variation&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;</li>
+ * <li>&lt;path&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;</li>
+ * <li>&lt;path&gt;_&lt;locale&gt;.&lt;extension&gt;</li>
+ * <li>&lt;path&gt;_&lt;style&gt;.&lt;extension&gt;</li>
+ * <li>&lt;path&gt;.&lt;extension&gt;</li>
  * </ol>
  * <p>
  * Locales may contain a language, a country and a region or variant. Combinations of these


[3/4] git commit: Fix javadoc - the name of the JavaScript function to submit a form is just 'submit'

Posted by mg...@apache.org.
Fix javadoc - the name of the JavaScript function to submit a form is just 'submit'

(cherry picked from commit 35c80feb09986c36239257975ca9824f1041cb67)


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

Branch: refs/heads/master
Commit: 84e437ef64f38a56998d7ff2dd9c4149d23c2d1d
Parents: 95c1104
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri May 30 10:30:29 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 4 20:04:05 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/wicket/blob/84e437ef/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
index b54d995..06ff0da 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java
@@ -883,7 +883,7 @@ public class Form<T> extends WebMarkupContainer implements IFormSubmitListener,
 	 * @param submittingComponent
 	 *            component responsible for submitting the form, or <code>null</code> if none (eg
 	 *            the form has been submitted via the enter key or javascript calling
-	 *            form.onsubmit())
+	 *            form.submit())
 	 * 
 	 * @see #delegateSubmit(IFormSubmitter) for an easy way to process submitting component in the
 	 *      default manner


[4/4] git commit: WICKET-5240 Add ModificationWatcher implementation that uses NIO2 file system polling

Posted by mg...@apache.org.
WICKET-5240 Add ModificationWatcher implementation that uses NIO2 file system polling

Allow the poll frequence to be configurable.
Add support for modification and deletion events


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

Branch: refs/heads/master
Commit: a82389b8133f18edece0720717a8e5481f49378c
Parents: d66d2e3
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 4 21:19:37 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 4 21:19:37 2014 +0200

----------------------------------------------------------------------
 .../util/watch/Nio2ModificationWatcher.java     | 145 ++++++++++++++-----
 1 file changed, 110 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a82389b8/wicket-core/src/main/java/org/apache/wicket/core/util/watch/Nio2ModificationWatcher.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/watch/Nio2ModificationWatcher.java b/wicket-core/src/main/java/org/apache/wicket/core/util/watch/Nio2ModificationWatcher.java
index ab1f099..158ffa2 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/watch/Nio2ModificationWatcher.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/watch/Nio2ModificationWatcher.java
@@ -17,6 +17,8 @@
 package org.apache.wicket.core.util.watch;
 
 import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
+import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
 
 import java.io.File;
 import java.io.IOException;
@@ -64,7 +66,15 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 	/** the <code>Task</code> to run */
 	private Task task;
 
-	public Nio2ModificationWatcher(final Application application)
+	/**
+	 * Constructor.
+	 *
+	 * @param application
+	 *              The application that manages the caches
+	 * @param pollFrequency
+	 *              How often to check on <code>IModifiable</code>s
+	 */
+	public Nio2ModificationWatcher(final Application application, Duration pollFrequency)
 	{
 		try
 		{
@@ -73,7 +83,7 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 			this.watchService = FileSystems.getDefault().newWatchService();
 			registerWatchables(watchService);
 
-			start(Duration.seconds(2));
+			start(pollFrequency);
 
 		} catch (IOException iox)
 		{
@@ -91,7 +101,7 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 			@Override
 			public void run(final Logger log)
 			{
-				checkCreated();
+				checkCreated(log);
 				checkModified();
 			}
 		});
@@ -102,8 +112,10 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 	 * New folders are registered to be watched.
 	 * New files are removed from the MarkupCache because there could be
 	 * {@link org.apache.wicket.markup.Markup#NO_MARKUP} (Not Found) entries for them already.
+	 * @param log
+	 *              a logger that can be used to log the events
 	 */
-	protected void checkCreated()
+	protected void checkCreated(Logger log)
 	{
 		WatchKey watchKey = watchService.poll();
 		if (watchKey != null)
@@ -116,32 +128,15 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 
 				if (eventKind == ENTRY_CREATE)
 				{
-					if (Files.isDirectory(eventPath))
-					{
-						try
-						{
-							// a directory is created. register it for notifications
-							register(eventPath, watchService);
-						} catch (IOException iox)
-						{
-							LOG.warn("Cannot register folder '" + eventPath + "' to be watched.", iox);
-						}
-					}
-					else
-					{
-						// a new file appeared. we need to clear the NOT_FOUND entry that may be added earlier.
-						// MarkupCache keys are fully qualified URIs
-						String absolutePath = eventPath.toAbsolutePath().toFile().toURI().toString();
-
-						try
-						{
-							ThreadContext.setApplication(application);
-							application.getMarkupSettings()
-									.getMarkupFactory().getMarkupCache().removeMarkup(absolutePath);
-						} finally {
-							ThreadContext.setApplication(null);
-						}
-					}
+					entryCreated(eventPath, log);
+				}
+				else if (eventKind == ENTRY_DELETE)
+				{
+					entryDeleted(eventPath, log);
+				}
+				else if (eventKind == ENTRY_MODIFY)
+				{
+					entryModified(eventPath, log);
 				}
 			}
 
@@ -149,14 +144,83 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 		}
 	}
 
+	/**
+	 * A callback method called when a new Path entry is modified
+	 *
+	 * @param path
+	 *              the modified path
+	 * @param log
+	 *              a logger that can be used to log the events
+	 */
+	protected void entryModified(Path path, Logger log)
+	{
+	}
+
+	/**
+	 * A callback method called when a new Path entry is deleted
+	 *
+	 * @param path
+	 *              the deleted path
+	 * @param log
+	 *              a logger that can be used to log the events
+	 */
+	protected void entryDeleted(Path path, Logger log)
+	{
+	}
+
+	/**
+	 * A callback method called when a new Path entry is created
+	 *
+	 * @param path
+	 *              the new path entry
+	 * @param log
+	 *              a logger that can be used to log the events
+	 */
+	protected void entryCreated(Path path, Logger log)
+	{
+		if (Files.isDirectory(path))
+		{
+			try
+			{
+				// a directory is created. register it for notifications
+				register(path, watchService);
+			} catch (IOException iox)
+			{
+				log.warn("Cannot register folder '" + path + "' to be watched.", iox);
+			}
+		}
+		else
+		{
+			// A new file is created. We need to clear the NOT_FOUND entry that may have been added earlier.
+			// MarkupCache keys are fully qualified URIs
+			String absolutePath = path.toAbsolutePath().toFile().toURI().toString();
+
+			try
+			{
+				ThreadContext.setApplication(application);
+				application.getMarkupSettings()
+						.getMarkupFactory().getMarkupCache().removeMarkup(absolutePath);
+			} finally {
+				ThreadContext.setApplication(null);
+			}
+		}
+	}
+
 	@Override
 	public void destroy()
 	{
-		if (task != null)
+		try
+		{
+			super.destroy();
+
+			if (task != null)
+			{
+				task.interrupt();
+			}
+		} finally
 		{
-			task.interrupt();
+			IOUtils.closeQuietly(watchService);
 		}
-		IOUtils.closeQuietly(watchService);
 	}
 
 	/**
@@ -195,7 +259,18 @@ public class Nio2ModificationWatcher extends ModificationWatcher
 	
 	private void register(final Path folder, final WatchService watchService) throws IOException
 	{
-		LOG.debug("Registering folder '{}'", folder);
-		folder.register(watchService, ENTRY_CREATE);
+		WatchEvent.Kind[] watchedKinds = getWatchedKinds(folder);
+		LOG.debug("Registering folder '{}' to the watching service with kinds: {}", folder, watchedKinds);
+		folder.register(watchService, watchedKinds);
+	}
+
+	/**
+	 * @param folder
+	 *          the folder that will be watched
+	 * @return an array of watch event kinds to use for the watching of the given folder
+	 */
+	protected WatchEvent.Kind[] getWatchedKinds(Path folder)
+	{
+		return new WatchEvent.Kind[] {ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY};
 	}
 }


[2/4] git commit: Upgrade Jetty to 9.2.0

Posted by mg...@apache.org.
Upgrade Jetty to 9.2.0


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

Branch: refs/heads/master
Commit: 62f5becdff40c3e3db7512687f163bc50cb07cf3
Parents: 84e437e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Jun 1 12:29:36 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 4 20:04:05 2014 +0200

----------------------------------------------------------------------
 .../quickstart/src/main/resources/archetype-resources/pom.xml      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/62f5becd/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml b/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
index 2b97f5e..ea69f64 100644
--- a/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
@@ -43,7 +43,7 @@
 	</licenses>
 	<properties>
 		<wicket.version>7.0.0-SNAPSHOT</wicket.version>
-		<jetty9.version>9.1.5.v20140505</jetty9.version>
+		<jetty9.version>9.2.0.v20140526</jetty9.version>
 		<log4j.version>1.2.17</log4j.version>
 		<slf4j.version>1.7.7</slf4j.version>
 		<junit.version>4.11</junit.version>