[ 
https://issues.apache.org/jira/browse/WICKET-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12899955#action_12899955
 ] 

Peter Ertl commented on WICKET-3001:
------------------------------------

wicket looks up the current request handler on the stack with

                        if (requestCycle.getActiveRequestHandler() instanceof 
AjaxRequestTarget)

but the current request handler during onClick is still 
ListenerInterfaceRequestHandler.

The AjaxRequestTarget that we want instead is scheduled for execution on the 
request handler stack.

So I guess we just have to include a test if the scheduled handler is 
AjaxRequestTarget and return it.

suggested patch included, please check first (I am still not that deep into 
request handling in 1.5.x) !!!!

> AjaxRequestTarget.get returns null within AjaxLink#onClick
> ----------------------------------------------------------
>
>                 Key: WICKET-3001
>                 URL: https://issues.apache.org/jira/browse/WICKET-3001
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M1
>            Reporter: Daniel Soneira
>
> Code:
> --------------------------
> ...
> new AjaxLink<Void>("link") {
>     @Override
>     public void onClick(AjaxRequestTarget target) {
>         feedback("link clicked");
>     }
> }
> public void feedback(String message) {
>      info(message);
>      AjaxRequestTarget target = AjaxRequestTarget.get();
>      if (target != null) {
>          target.addComponent(get("feedback"));
>      }
> }
> ...
> -------------------------- 
> In previous versions of Wicket this code worked.
> Now target is null and therefore the feedback panel is not re-rendered.
> Debugging AjaxRequestTarget.get shows that the active request handler is a 
> ListenerInterfaceRequestHandler with an AjaxRequestTarget as next "scheduled" 
> handler. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to