This is an automated email from the ASF dual-hosted git repository. reiern70 pushed a commit to branch reiern70/issue_1492 in repository https://gitbox.apache.org/repos/asf/wicket.git
commit d57ed6e622e4fe75e0a6f3c71318a847b8a6ae70 Author: reiern70 <[email protected]> AuthorDate: Fri Jun 19 16:00:51 2026 -0500 [https://github.com/apache/wicket/issues/1492] make partial page update creation pluggable. --- .../org/apache/wicket/ajax/AjaxRequestHandler.java | 21 ++++++++++++++++----- .../org/apache/wicket/page/PartialPageUpdate.java | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java index d9a1d386ad..c0c650a807 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java @@ -83,10 +83,10 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem private final PartialPageUpdate update; /** a set of listeners */ - private Set<AjaxRequestTarget.IListener> listeners = null; + protected Set<AjaxRequestTarget.IListener> listeners = null; /** */ - private final Set<ITargetRespondListener> respondListeners = new HashSet<>(); + protected final Set<ITargetRespondListener> respondListeners = new HashSet<>(); /** see https://issues.apache.org/jira/browse/WICKET-3564 */ protected transient boolean respondersFrozen; @@ -104,7 +104,18 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem { super(page); - update = new XmlPartialPageUpdate(page) + update = newPartialPageUpdate(page); + } + + /** + * Factory method for {@link PartialPageUpdate}'s + * + * @param page The {@link Page} + * @return an instance of {@link PartialPageUpdate} + */ + protected PartialPageUpdate newPartialPageUpdate(final Page page) + { + return new XmlPartialPageUpdate(page) { /** * Freezes the {@link AjaxRequestHandler#listeners} before firing the event and @@ -130,7 +141,7 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem /** * Freezes the {@link AjaxRequestHandler#listeners}, and does not un-freeze them as the * events will have been fired by now. - * + * * @param response * the response to write to */ @@ -143,7 +154,7 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem if (listeners != null) { final Map<String, Component> components = Collections - .unmodifiableMap(markupIdToComponent); + .unmodifiableMap(markupIdToComponent); for (AjaxRequestTarget.IListener listener : listeners) { diff --git a/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java b/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java index 98fb9880a7..67871bdd62 100644 --- a/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java +++ b/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java @@ -75,7 +75,7 @@ public abstract class PartialPageUpdate * Length of the script block that combined scripts are wrapped in. This includes the script tag, * CDATA and if CSP is enabled also the nonce. */ - private static final int SCRIPT_BLOCK_LENGTH = 100; + protected static final int SCRIPT_BLOCK_LENGTH = 100; /** * A list of scripts (JavaScript) which should be executed on the client side before the
