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 2012/10/15 15:36:40 UTC
[1/2] git commit: WICKET-4777 JavaScriptReference escapes given URL
Updated Branches:
refs/heads/wicket-1.5.x 57ee0b76f -> c3c29f8e8
WICKET-4777 JavaScriptReference escapes given URL
Escape the url only in Ajax requests because otherwise ampersands in the url query string break the <ajax-response> XML with "Entity not closed with ;"
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c3c29f8e
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c3c29f8e
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c3c29f8e
Branch: refs/heads/wicket-1.5.x
Commit: c3c29f8e807bb6cc83a42aa06c1a25ebddbc022c
Parents: 8647a4c
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Oct 15 15:11:16 2012 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Oct 15 15:11:16 2012 +0200
----------------------------------------------------------------------
.../markup/html/internal/HeaderResponse.java | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/c3c29f8e/wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java
index 2ef8216..cd44d5c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/internal/HeaderResponse.java
@@ -21,6 +21,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.WicketEventReference;
import org.apache.wicket.request.IRequestHandler;
@@ -239,7 +240,11 @@ public abstract class HeaderResponse implements IHeaderResponse
if (token1Unused && token2Unused)
{
- JavaScriptUtils.writeJavaScriptUrl(getResponse(), url, id, defer,
+ boolean isAjax = AjaxRequestTarget.get() != null;
+ // the url needs to be escaped when Ajax, because it will break the Ajax Response XML (WICKET-4777)
+ CharSequence escapedUrl = isAjax ? Strings.escapeMarkup(url): url;
+
+ JavaScriptUtils.writeJavaScriptUrl(getResponse(), escapedUrl, id, defer,
charset);
markRendered(token1);
if (token2 != null)