You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Makundi (JIRA)" <ji...@apache.org> on 2009/07/19 08:51:14 UTC

[jira] Created: (WICKET-2379) Redirect fails wicketTest in rc7

Redirect fails wicketTest in rc7
--------------------------------

                 Key: WICKET-2379
                 URL: https://issues.apache.org/jira/browse/WICKET-2379
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4-RC7
            Reporter: Martin Makundi


1. click ajaxButton
2. redirect in button onSubmit
3. verify redirect in test <FAILS>

See attached quickstart

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


[jira] Commented: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Grigorov commented on WICKET-2379:
-----------------------------------------

The main problem here is that you use *Ajax* button to make a redirect to external host.
As you may know ajax requests receive partial page responses. So if there is no special handling of http code 302 in wicket-ajax.js then there is no way to make a redirect via Ajax. Even if there is a special handling for this in wicket-ajax.js then WicketTester could not be aware of that.
Making the form submit with non-Ajax button makes the test passing.

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Commented: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Makundi commented on WICKET-2379:
----------------------------------------

My only problem is that the test fails. In real live wicket app it works like a charm.

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Commented: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Makundi commented on WICKET-2379:
----------------------------------------

If I recall correctly, this is why I switched to throw RestartResponseException.. because setResponsePage alone would not give the same result.

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Updated: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Makundi updated WICKET-2379:
-----------------------------------

    Attachment: Wicket-Quickstart.zip

See unit test:
1. click ajaxButton
2. redirect in button onSubmit
3. verify redirect in test <FAILS> 

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Commented: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Grigorov commented on WICKET-2379:
-----------------------------------------

Yes, I see it should work now as it is.
Currently if it is a Ajax request WebResponse#redirect(String) doesn't call #sendRedirect() of the underlying HttpServletResponse and thus MockHttpServletResponse doesn't have the information you are trying to validate in the test.

If WebResponse#redirect(String) is changed to call HttpServletResponse#sendRedirect() for Ajax requests too then wicket-ajax.js should be changed as well to process response's 'status == 302' and header 'Location'. This sounds like the normal way to process it but who knows maybe there were problems with some browsers ...  

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Resolved: (WICKET-2379) Redirect fails wicketTest in rc7

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

Igor Vaynberg resolved WICKET-2379.
-----------------------------------

      Assignee: Igor Vaynberg
    Resolution: Won't Fix

there are indeed problems with sending a 302 as a response to an ajax call. some browsers take over and handle it automatically, but we need to be able to do some processing steps before we redirect.

you can easily validate the url happens like this:

assertEquals("http://testUrl", tester.getServletResponse().getHeader("Ajax-Location"));

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>            Assignee: Igor Vaynberg
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Commented: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Makundi commented on WICKET-2379:
----------------------------------------

In my understanding this works fine with the browser. So all redirects should be obeyed with wicketTester, ajax or non ajax.

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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


[jira] Commented: (WICKET-2379) Redirect fails wicketTest in rc7

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

Martin Grigorov commented on WICKET-2379:
-----------------------------------------

@Devs: currently WebResponse (line 224) sets status 200 and adds a header 'Ajax-Location' for redirects in Ajax requests. Later wicket-ajax.js (line 928) checks for that header and makes the redirect.
Honestly I didn't test that scenario but I want to ask: did you experienced any problems with returning status = 302 and use header 'Location' instead ?

> Redirect fails wicketTest in rc7
> --------------------------------
>
>                 Key: WICKET-2379
>                 URL: https://issues.apache.org/jira/browse/WICKET-2379
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC7
>            Reporter: Martin Makundi
>         Attachments: Wicket-Quickstart.zip
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 1. click ajaxButton
> 2. redirect in button onSubmit
> 3. verify redirect in test <FAILS>
> See attached quickstart

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