* Tremelune:
>
> 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);
> }
> }
> };
> }
> });
> }
> }
You should not use mount() here, just get rid of it and only use
the custom BookmarkablePageRequestTarget.
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user