You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Frank Bille Jensen (JIRA)" <ji...@apache.org> on 2008/06/13 09:34:45 UTC

[jira] Commented: (WICKET-1628) WicketTester processRequestCycle fails to redirect from a mounted bookmarkable page if response is restarted at intercept page

    [ https://issues.apache.org/jira/browse/WICKET-1628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12604759#action_12604759 ] 

Frank Bille Jensen commented on WICKET-1628:
--------------------------------------------

I think it's because you are not including both the servletpath and the context in the URL. 

Try something like this instead:

MockHttpServletRequest servletRequest = tester.getServletRequest();
		String newUrl = "http://localhost" + servletRequest.getServletPath() + "" +
			servletRequest.getContextPath() + "/" + url;

> WicketTester processRequestCycle fails to redirect from a mounted bookmarkable page if response is restarted at intercept page
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1628
>                 URL: https://issues.apache.org/jira/browse/WICKET-1628
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-final
>            Reporter: Nick Johnson
>            Assignee: Frank Bille Jensen
>
> If in the WebApplication's init method, you call mountBookmarkablePage("/foo", Foo.class), and in a unit test do something like this:
> 		tester.setupRequestAndResponse(); 
> 		final WebRequestCycle cycle = tester.createRequestCycle(); 
> 		final String url = cycle.urlFor(Foo.class, pageParameters).toString(); 
> 		// set up and normalize a complete URL
> 		final URL oldUrl = new URL(tester.getServletRequest().getRequestURL().toString());
> 		final URI newUrl = new URL(oldUrl.getProtocol(), oldUrl.getHost(), oldUrl.getPort(), oldUrl.getPath() + "/" + url).toURI().normalize();
> 		
> 		tester.getServletRequest().setURL(newUrl.toASCIIString()); 
> 		tester.processRequestCycle(); 
> If Foo.class will throw a RestartResponseAtInterceptPageException (e.g., to force a login), then the following assertion will fail with "page was null":
> 		tester.assertRenderedPage(Login.class); 
> If the page isn't mounted in the WebApplication, it works as expected.

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