You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Daniel Soneira (JIRA)" <ji...@apache.org> on 2010/08/18 18:24:17 UTC

[jira] Created: (WICKET-3001) AjaxRequestTarget.get returns null within AjaxLink#onClick

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.


[jira] Commented: (WICKET-3001) AjaxRequestTarget.get returns null within AjaxLink#onClick

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900935#action_12900935 ] 

Hudson commented on WICKET-3001:
--------------------------------

Integrated in Apache Wicket 1.5.x #252 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.5.x/252/])
    AjaxRequestTarget.get returns null within AjaxLink#onClick
Issue: WICKET-3001


> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-M2
>
>         Attachments: lookup-art.patch
>
>
> 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.


[jira] Updated: (WICKET-3001) AjaxRequestTarget.get returns null within AjaxLink#onClick

Posted by "Peter Ertl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Ertl updated WICKET-3001:
-------------------------------

    Attachment: lookup-art.patch

> 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
>         Attachments: lookup-art.patch
>
>
> 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.


[jira] Resolved: (WICKET-3001) AjaxRequestTarget.get returns null within AjaxLink#onClick

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3001.
-----------------------------------

         Assignee: Igor Vaynberg
    Fix Version/s: 1.5-M2
       Resolution: Fixed

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-M2
>
>         Attachments: lookup-art.patch
>
>
> 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.


[jira] Commented: (WICKET-3001) AjaxRequestTarget.get returns null within AjaxLink#onClick

Posted by "Peter Ertl (JIRA)" <ji...@apache.org>.
    [ 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.