You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Maurice Marrink (JIRA)" <ji...@apache.org> on 2007/08/23 14:08:32 UTC

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

    [ https://issues.apache.org/jira/browse/WICKET-702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522117 ] 

Maurice Marrink commented on WICKET-702:
----------------------------------------

As submitted to the user list the current resolution breaks the behavior of continueToOriginalDestination  when not using mounted urls. Uncomment the code in org.apache.wicket.markup.html.form.login.InterceptTest to see it fail.

> 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-beta4
>
>         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.