Why do you mount in the WebPage and not in the Application.init() ? I'm new to wicket. A problem, I see is that each time the Welcome page is instantiated, then you try to mount (re add the rules). (You copy from the staticpage examples but you don't paste in Application like in the examples.)
Regards. Tremelune wrote: > 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); > } > } > }; > } > }); > } > } > ------------------------------------------------------------------------- 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