[
https://issues.apache.org/jira/browse/WICKET-1734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg resolved WICKET-1734.
-----------------------------------
Assignee: Igor Vaynberg
Resolution: Incomplete
please test with latest 1.5.x, and if still broken reopen with a quickstart.
> WicketTester AJAX requests don't always include the 'parametersForNextRequest'
> ------------------------------------------------------------------------------
>
> Key: WICKET-1734
> URL: https://issues.apache.org/jira/browse/WICKET-1734
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.3
> Reporter: David Shepherdson
> Assignee: Igor Vaynberg
> Priority: Minor
>
> If the RequestCycle already exists (i.e. RequestCycle.get() returns
> non-null), BaseWicketTester's executeAjaxEvent() and executeBehavior() don't
> call setupRequestAndResponse(), meaning that they don't transfer the
> 'parameters for next request' into the servlet request before processing.
> Therefore, if you set some parameters and then execute an AJAX behaviour or
> event, your parameters won't always be included when the request is processed.
> We're working around the problem by overriding the two affected methods as
> follows:
> @Override
> public void executeAjaxEvent(Component component, String event) {
> if (RequestCycle.get() != null) {
> // The super implementation won't initialise the request,
> // and hence won't copy across the parametersForNextRequest,
> // so we need to do it now.
>
> getServletRequest().getParameterMap().putAll(getParametersForNextRequest());
> getParametersForNextRequest().clear();
> }
> super.executeAjaxEvent(component, event);
> }
> @Override
> public void executeBehavior(AbstractAjaxBehavior behavior) {
> // Need to create a 'throwaway' request cycle first so that the
> callback
> // URL can be generated.
> WebRequestCycle cycle = createRequestCycle();
> CharSequence url = behavior.getCallbackUrl(false);
> // Save the parameters for the next request; we'll need them in a
> // moment, and they'll be cleared by setupRequestAndResponse()
> Map params = new HashMap(getParametersForNextRequest());
> cycle = setupRequestAndResponse(true);
> getServletRequest().setRequestToRedirectString(url.toString());
> // Restore parameters before processing the request.
> getServletRequest().getParameterMap().putAll(params);
> // Now we're ready to go!
> processRequestCycle(cycle);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.