cool. let's put this to the wiki (or maybe org.apache.util.* ???) and
help some people out there :-)
Am 06.11.2008 um 23:01 schrieb cjlyth:
getBinaryContent was not returning anything for me. When i simply
changed it
to return tester.getServletResponse().getDocument() everything
seemed to
work.
Here is the sample that works in a jUnit test, I have not yet
integrated
this into any real applications.
public String renderPageToString(final Class<? extends Page>
pageClass,
final PageParameters pageParameters) {
try {
final WebApplication app =
(WebApplication)WebApplication.get();
return Executors.newSingleThreadExecutor().submit(
new Callable<String>() {
public String call() throws
Exception {
final WicketTester
tester = new WicketTester(app);
tester.startPage(pageClass, pageParameters);
tester.assertNoErrorMessage();
return
tester.getServletResponse().getDocument();
}
}).get();
} catch (InterruptedException e) {
throw new WicketRuntimeException(e.getMessage(), e);
} catch (ExecutionException e) {
throw new WicketRuntimeException(e.getMessage(), e);
}
}
Peter Ertl wrote:
...
return new
String(tester.getServletResponse().getBinaryContent(),
tester.getServletResponse().getCharacterEncoding());
...
--
View this message in context:
http://www.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p20370600.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]