[
https://issues.apache.org/jira/browse/WICKET-1093?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Johan Compagner closed WICKET-1093.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.3.0-rc2
> BaseWicketTester doesn't call detach() for AJAX requests
> --------------------------------------------------------
>
> Key: WICKET-1093
> URL: https://issues.apache.org/jira/browse/WICKET-1093
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 1.3.0-beta4
> Reporter: David Shepherdson
> Fix For: 1.3.0-rc2
>
>
> BaseWicketTester doesn't call detach() on the request cycle when clicking an
> AJAX link. This does not match the behaviour when running in a 'real' servlet
> container, when detach() *does* get called for the same AJAX requests.
> One side effect of this is that AJAX header contributions are left in the
> page and cause problems when the next request occurs. For example, we have a
> page that we want to test. It contains an AJAX link and a (non-AJAX) form. We
> click the link, then fill in and submit the form. However, an exception is
> thrown when submitting the form as it tries to render the AJAX header
> contribution left over from the AJAX page. (Exception comes from
> checkHeaderRendering() in AjaxHeaderResponse.)
> We are working around this problem by overriding BaseWicketTester's
> clickLink(String, boolean) method, so as to hang onto the RequestCycle and
> call its detach() method once the response has been made for AJAX requests;
> for example:
> RequestCycle requestCycle = null;
> if (linkComponent instanceof AjaxLink) {
> ...
> setupRequestAndResponse();
> requestCycle = createRequestCycle();
> AjaxRequestTarget target = new AjaxRequestTarget(link.getPage());
> requestCycle.setRequestTarget(target);
> link.onClick(target);
> target.respond(requestCycle);
> }
> ...
> if (requestCycle != null) {
> // Detach the requestCycle, so that state isn't left around
> // for any further use of this page.
> requestCycle.detach();
> }
> This should be a very simple one-line fix (well, 1 x the number of AJAX
> requests made in BaseWicketTester's clickLink(...) method, which is 3).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.