You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Mark Sandori (JIRA)" <ji...@apache.org> on 2007/06/26 23:33:26 UTC

[jira] Created: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
------------------------------------------------------------------------------------------------------------

                 Key: WICKET-702
                 URL: https://issues.apache.org/jira/browse/WICKET-702
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.0-beta1
            Reporter: Mark Sandori


The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.

This is the test:

  @Test
    public void testPageRender()
    {
        WicketTest tester = new WicketTester(new MyApplication());
        //must be logged in to get to the Profile page
        tester.startPage(Profile.class);
        //should redirect to the Login page
        tester.assertRenderedPage(Login.class);
    }

The application mounts pages via:

mount("/main", PackageName.forPackage(Profile.class.getPackage()));

Running the test results in this exception:

org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)

What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.

If the mount() is removed then the unit test passes.

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


Re: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
Dear developers,

We have something wrong with relative URLs, see:

https://issues.apache.org/jira/browse/WICKET-702
MockWebApplication doesn't redirect properly to mounted pages
under RestartResponseAtInterceptPageException

I added the user-provided test case for this, to reproduce it
execute org.apache.wicket.redirect.RestartWithMountedPageTest
after renaming bugTestXXX() to testXXX()

I found a workaround for the issue, but it is not good enough as
redirect URL are already supposed to be absolute, and it breaks
some unit tests:

https://issues.apache.org/jira/secure/attachment/12361056/20070703-WICKET-702.txt

Your help will be appreciated.
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Mark Sandori updated WICKET-702:
--------------------------------

    Attachment: LoginPage.html

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Mark Sandori updated WICKET-702:
--------------------------------

    Attachment: RestartWithMountedPageTest.java

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>         Attachments: RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Mark Sandori updated WICKET-702:
--------------------------------

    Attachment: ProtectedPage.html

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Commented: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508463 ] 

Jean-Baptiste Quenot commented on WICKET-702:
---------------------------------------------

Would you please file a patch to complement the existing unit tests in jdk-1.4/wicket/src/test/java so that we can work on this bug and find a fix, or provide new unit tests as attachment?

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Commented: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512905 ] 

Jean-Baptiste Quenot commented on WICKET-702:
---------------------------------------------

Anyone tested the patch successfully?  Any feedback on this?  Any better idea to fix this?

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>            Assignee: Jean-Baptiste Quenot
>             Fix For: 1.3.0-beta3
>
>         Attachments: 20070703-WICKET-702.txt, LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Jean-Baptiste Quenot updated WICKET-702:
----------------------------------------

    Attachment: 20070703-WICKET-702.txt

This patch provides a workaround for the issue, but it is not good enough as redirect URL is already supposed to be absolute, and it breaks some unit tests.

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>            Assignee: Jean-Baptiste Quenot
>             Fix For: 1.3.0-beta3
>
>         Attachments: 20070703-WICKET-702.txt, LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Commented: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

Posted by "Mark Sandori (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509875 ] 

Mark Sandori commented on WICKET-702:
-------------------------------------

I have attached a new unit test that demonstrates this issue.

I have not committed to the Wicket codebase before so I didn't want to submit a patch and I am not sure of the best location for this test so it is just setup to work in the root test directory.

If the "getApplication().mountxxx()" calls are removed, then the tests pass.

I don't know enough about the Wicket internals to propose how to correct the problem.

Thanks.


> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Mark Sandori updated WICKET-702:
--------------------------------

    Attachment: ProtectedPage.java

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Assigned: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Jean-Baptiste Quenot reassigned WICKET-702:
-------------------------------------------

    Assignee: Jean-Baptiste Quenot

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>            Assignee: Jean-Baptiste Quenot
>             Fix For: 1.3.0-beta3
>
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Jean-Baptiste Quenot updated WICKET-702:
----------------------------------------

    Fix Version/s: 1.3.0-beta3

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>            Assignee: Jean-Baptiste Quenot
>             Fix For: 1.3.0-beta3
>
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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


[jira] Updated: (WICKET-702) MockWebApplication doesn't redirect properly to mounted pages under RestartResponseAtInterceptPageException

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

Mark Sandori updated WICKET-702:
--------------------------------

    Attachment: LoginPage.java

> MockWebApplication doesn't redirect  properly to mounted pages under RestartResponseAtInterceptPageException
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-702
>                 URL: https://issues.apache.org/jira/browse/WICKET-702
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Mark Sandori
>         Attachments: LoginPage.html, LoginPage.java, ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java
>
>
> The MockWebApplication doesn't decode the redirect request properly when redirecting to a mounted page due to a RestartResponseAtInterceptPageException.
> This is the test:
>   @Test
>     public void testPageRender()
>     {
>         WicketTest tester = new WicketTester(new MyApplication());
>         //must be logged in to get to the Profile page
>         tester.startPage(Profile.class);
>         //should redirect to the Login page
>         tester.assertRenderedPage(Login.class);
>     }
> The application mounts pages via:
> mount("/main", PackageName.forPackage(Profile.class.getPackage()));
> Running the test results in this exception:
> org.apache.wicket.WicketRuntimeException: Already redirecting to 'main/Login'. Cannot redirect more than once
> 	at org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100)
> 	at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219)
> 	at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103)
> 	at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981)
> 	at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048)
> 	at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127)
> 	at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
> 	at org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426)
> 	at org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372)
> 	at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237)
> What is happening is that the redirect URL "main/Login" is not getting resolved to a bookmarkable page and the RequestParameters is therefore not setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle requestCycle, final RequestParameters requestParameters) the bookmarkablePageClass of the requestParameters is null and the method resolves to the Home page instead of the page that is intended to redirect to. This causes an attempt to redirect again thereby causing the exception.
> If the mount() is removed then the unit test passes.

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