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