Repository: tapestry-5 Updated Branches: refs/heads/master d9b3813a0 -> 0d3c9bc95
TAP5-1941: Alerts component can fail with ComponentEventException is dismiss event triggered outside of XHR request (e.g., by web crawler) Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/0d3c9bc9 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/0d3c9bc9 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/0d3c9bc9 Branch: refs/heads/master Commit: 0d3c9bc950adcf837ae4378e2efe490763cc10fa Parents: d9b3813 Author: Howard M. Lewis Ship <[email protected]> Authored: Fri Aug 1 10:22:26 2014 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Fri Aug 1 10:22:26 2014 -0700 ---------------------------------------------------------------------- .../apache/tapestry5/corelib/components/Alerts.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0d3c9bc9/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java index c8bc5bb..16408c2 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Alerts.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 The Apache Software Foundation -// // Licensed 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 @@ -23,6 +21,7 @@ import org.apache.tapestry5.annotations.*; import org.apache.tapestry5.corelib.base.BaseClientElement; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.json.JSONObject; +import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.compatibility.DeprecationWarning; /** @@ -44,7 +43,7 @@ public class Alerts extends BaseClientElement * Allows the button used to dismiss all alerts to be customized (and localized). * * @deprecated Deprecated in Tapestry 5.4; override the {@code core-dismiss-label} message key in - * your application's message catalog. This parameter is now ignored. + * your application's message catalog. This parameter is now ignored. */ @Parameter(value = "message:core-dismiss-label", defaultPrefix = BindingConstants.LITERAL) private String dismissText; @@ -63,6 +62,9 @@ public class Alerts extends BaseClientElement @Inject private DeprecationWarning deprecationWarning; + @Inject + private Request request; + void onPageLoaded() { deprecationWarning.ignoredComponentParameters(resources, "dismissText"); @@ -100,6 +102,12 @@ public class Alerts extends BaseClientElement } } + // See TAP5-1941 + if (!request.isXHR()) + { + return true; + } + return new JSONObject(); }
