I'm having a great deal of trouble getting this to fire. How does one
accomplish this in the middle of, say, some run-of-the-mill Wicket page? If
I do something like this, I get an error that "/pages" has already been
mounted (which it has, during my app's initialization). I also tried to do
all this in a unit test, but the overridden method never fired. I can't seem
to figure out where this gets plugged in. Example:

class Welcome extends WebPage {
  Welcome() {
    ((WebApplication) getApplication()).mount(new
URIRequestTargetUrlCodingStrategy("/pages") {
      @Override
      public IRequestTarget decode(RequestParameters requestParameters) {
        final ValueMap requestParams = decodeParameters(requestParameters);
        PageParameters params = new PageParameters();
        params.put("uri", requestParams.get(URI));
        return new BookmarkablePageRequestTarget(Page.class, params) {
          @Override
          public void respond(RequestCycle requestCycle) {
            if (requestParams.getString("email") != null) {
              final StringResponse emailResponse = new StringResponse();
              final WebResponse originalResponse = (WebResponse)
RequestCycle.get().getResponse();
              RequestCycle.get().setResponse(emailResponse);
              super.respond(requestCycle);
              // Here send the email instead of dumping it to stdout!
              System.out.println(emailResponse.toString());
              RequestCycle.get().setResponse(originalResponse);
              RequestCycle.get().setRequestTarget(new
BookmarkablePageRequestTarget(TestEmail.class));
            } else {
              super.respond(requestCycle);
            }
          }
        };
      }
    });
  }
}

-- 
View this message in context: 
http://www.nabble.com/How-to-get-HTML-source-code-from-a-wicket-page-tf3968790.html#a11522836
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to