You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ad...@apache.org on 2015/05/05 15:18:45 UTC

wicket git commit: added a note about AjaxRequestTarget and AjaxRequestHandler

Repository: wicket
Updated Branches:
  refs/heads/master cca193ba8 -> de4e8a412


added a note about AjaxRequestTarget and AjaxRequestHandler


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

Branch: refs/heads/master
Commit: de4e8a412ea3663d974318d2b6331630bcea44d7
Parents: cca193b
Author: Andrea Del Bene <“adelbene@apache.org”>
Authored: Tue May 5 15:17:26 2015 +0200
Committer: Andrea Del Bene <“adelbene@apache.org”>
Committed: Tue May 5 15:17:26 2015 +0200

----------------------------------------------------------------------
 .../src/docs/guide/ajax/ajax_1.gdoc             | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/de4e8a41/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc b/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
index 5f1ccf5..0ab54fd 100644
--- a/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
+++ b/wicket-user-guide/src/docs/guide/ajax/ajax_1.gdoc
@@ -62,3 +62,35 @@ Repeaters component that have @org.apache.wicket.markup.repeater.AbstractRepeate
 
 If we want to refresh their markup via AJAX we must add one of their parent containers to the @AjaxRequestTarget@.
 {warning}
+
+The standard implementation of @AjaxRequestTarget@ used by Wicket is class @org.apache.wicket.ajax.AjaxRequestHandler@. To create new instances of @AjaxRequestTarget@ a Wicket application uses the provider object registered with method @setAjaxRequestTargetProvider@:
+
+{code}
+setAjaxRequestTargetProvider(
+		IContextProvider<AjaxRequestTarget, Page> ajaxRequestTargetProvider)
+{code}
+
+The provider is an implementation of interface @org.apache.wicket.util.IContextProvider@, hence to use custom implementations of @AjaxRequestTarget@ we must register a custom provider that returns the desired implementation: 
+
+{code}
+private static class MyCustomAjaxRequestTargetProvider implements
+		IContextProvider<AjaxRequestTarget, Page>
+	{
+		@Override
+		public AjaxRequestTarget get(Page page)
+		{
+			return new MyCustomAjaxRequestTarget();
+		}
+	}
+{code}
+
+{note}
+During request handling @AjaxRequestHandler@ sends an event to its application to notify the entire component hierarchy of the current page:
+
+{code}
+   //'page' is the associated Page instance
+   page.send(app, Broadcast.BREADTH, this);
+{code}
+
+The payload of the event is the @AjaxRequestHandler@ itself.
+{note}