You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by T P D <li...@diffenbach.org> on 2011/07/26 01:08:51 UTC

Rendering a page to a String, with absolute Wicket urls?

I want to render a page to a String in order to email it as HTML. I also 
want to include in that HTML links back to my Wicket application.

I know from googling that that's a perennial topic (and most of the 
answers on nabble go to dead links), but I am having trouble doing all 
three things that I want to do:

1. Render the string.
2. Get the absolute url of a wicket link into the string.
3. Use Pages that have custom constructors.


Currently, I'm using Wicket Tester to render to HTML. Unfortunately, 
that means that I can't get absolute urls, because in Wicket Tester, the 
RequestUtils.toAbolutePath() depends on the RequestCycle, and Tester has 
its own RequestCycle.

Using Jean-Baptiste Quenot's elegant 
CapturingBookmarkablePageRequestTarget 
(wicketstuff.org/wicket14/staticpages) renders the string, but I can't 
seem to get it to work with Pages instead of Class<? extends Page>s.

When I extend PageRequestTarget and call requestCycle.setReponse with a 
StringResponse, then pass the RequestCycle to render, it doesn't throw, 
but nothing is actually rendered.

Your help is appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org