You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by re...@apache.org on 2023/09/20 11:58:41 UTC
[wicket] branch reiern70/WICKET-7074 updated: [WICKET-7074] include comments
This is an automated email from the ASF dual-hosted git repository.
reiern70 pushed a commit to branch reiern70/WICKET-7074
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/reiern70/WICKET-7074 by this push:
new a5d7c973fb [WICKET-7074] include comments
a5d7c973fb is described below
commit a5d7c973fbf1f906ea1b6ab81cdde02c4cdf3ffc
Author: reiern70 <re...@gmail.com>
AuthorDate: Wed Sep 20 06:58:31 2023 -0500
[WICKET-7074] include comments
---
.../java/org/apache/wicket/ajax/AjaxRequestHandler.java | 4 ++--
.../org/apache/wicket/settings/RequestCycleSettings.java | 10 ++++++++++
.../java/org/apache/wicket/ajax/AjaxRequestHandlerTest.java | 13 ++++++-------
3 files changed, 18 insertions(+), 9 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 2f69f22b60..d9a1d386ad 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
@@ -139,7 +139,7 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem
{
listenersFrozen = true;
- // invoke onafterresponse event on listeners
+ // invoke onAfterRespond event on listeners
if (listeners != null)
{
final Map<String, Component> components = Collections
@@ -273,7 +273,7 @@ public class AjaxRequestHandler extends AbstractPartialPageRequestHandler implem
final List<IResponseFilter> filters = Application.get()
.getRequestCycleSettings()
.getResponseFilters();
- // KP-7074 we need to write to a temporary buffer, otherwise, if an exception is produced,
+ // WICKET-7074 we need to write to a temporary buffer, otherwise, if an exception is produced,
// and a redirect is done we will end up with a malformed XML
final StringResponse bodyResponse = new StringResponse();
update.writeTo(bodyResponse, encoding);
diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java
index b40317b9a1..b40e1c53b3 100644
--- a/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java
+++ b/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java
@@ -244,6 +244,16 @@ public class RequestCycleSettings
}
}
+ /**
+ * Allows to clear response filters.
+ */
+ public void clearResponseFilters()
+ {
+ if (responseFilters != null)
+ {
+ responseFilters.clear();
+ }
+ }
/**
* In order to do proper form parameter encoding it is important that the response and the
diff --git a/wicket-core/src/test/java/org/apache/wicket/ajax/AjaxRequestHandlerTest.java b/wicket-core/src/test/java/org/apache/wicket/ajax/AjaxRequestHandlerTest.java
index 61542ef102..26e3e1611f 100644
--- a/wicket-core/src/test/java/org/apache/wicket/ajax/AjaxRequestHandlerTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/ajax/AjaxRequestHandlerTest.java
@@ -321,11 +321,10 @@ class AjaxRequestHandlerTest extends WicketTestCase
return Wicket7074.class;
}
-
@Override
- public RuntimeConfigurationType getConfigurationType() {
- // this ise needed so that no filters are added
- return RuntimeConfigurationType.DEPLOYMENT;
+ protected void init() {
+ super.init();
+ getRequestCycleSettings().clearResponseFilters();
}
}
@@ -387,16 +386,16 @@ class AjaxRequestHandlerTest extends WicketTestCase
}
@Test
- void ajaxResposeIsEmptyIfExceptionIsProducedDuringRenderingAndNoFiltersAreSet() {
+ void ajaxResponseIsEmptyIfExceptionIsProducedDuringRenderingAndNoFiltersAreSet() {
Wicket7074Application application = new Wicket7074Application();
WicketTester tester = newWicketTester(application);
- // page renders normally first time
+ // the page renders normally the first time
tester.startPage(new Wicket7074());
// click on action to produce render phase error
assertThrows(WeirdException.class, () -> {
tester.clickLink("action");
});
- // AJAX response is written now into a buffer => response should empty
+ // AJAX response is written now into a buffer and to the response => response should empty
assertTrue(tester.getLastResponseAsString().isEmpty());
}