[ 
https://issues.apache.org/jira/browse/WICKET-4310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Grigorov resolved WICKET-4310.
-------------------------------------

    Resolution: Invalid

WicketTester touches the ThreadLocal's, so you need to preserve them:

                    Application application = ThreadContext.getApplication();
                    Session session = ThreadContext.getSession();
                    RequestCycle requestCycle = ThreadContext.getRequestCycle();
                    try {
                        WicketTester tester = new WicketTester();
                        tester.startPage(new EmailPage("hi there!"));
                        String renderedPage = 
tester.getLastResponse().getDocument();
                        System.out.println("rendered page: " + renderedPage);
                        tester.destroy();
                    } finally {
                        ThreadContext.setApplication(application);
                        ThreadContext.setSession(session);
                        ThreadContext.setRequestCycle(requestCycle);
                    }

Also destroy the tester after usage.
                
> setResponsePage() has no effect after WicketTester is used
> ----------------------------------------------------------
>
>                 Key: WICKET-4310
>                 URL: https://issues.apache.org/jira/browse/WICKET-4310
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.3
>         Environment: OSX Lion, JDK 1.6.0_29
>            Reporter: George Armhold
>            Priority: Minor
>         Attachments: tester.tar.gz
>
>
> I'm using WicketTester to render a Page into text. I think this pattern has 
> been recommended a few times on the mailing list for things like rendering 
> pages into text for sending email.
> However after invoking "new WicketTester()", the browser does not seem to 
> load the page which is specified in setResponsePage(ResultPage.class)- the 
> browser remains on the page with the initial form.
> I will attach a quickstart to demonstrate.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to