Hi, Wicket users,
I'd like to have a mount whose sole purpose is to redirect the user to
1 of 2 WebPages after evaluating a GET query string. Furthermore, I'd
like to have the 2 possible pages configurable on a per-WebApplication
basis.
Today I override WebApplication#init() with a mount:
mountBookmarkablePage( "/redirector", RedirectorPage.class );
My RedirectorPage.class extends WebPage, but it doesn't have any
associated markup because the RedirectorPage simply calls
setResponsePage after evaluation of the query string. My
RedirectorPage currently hardcodes the 2 possible final destination
WebPages, and I'd like to make this reusable across a number of
WebApplications.
So, my questions are:
1) I think I'm abusing (conceptually) a mounted WebPage here, because
a WebPage is never rendered. Is there a better practice for trapping
a GET directed at a given URL? Do I want to explore a custom
IRequestTargetUrlCodingStrategy?
2) Assuming a mount of a WebPage is the best way, there is no
straight-forward way to configure a RedirectorPage instance so that I
can set the 2 response pages on a per-WebApplication basis. I'm
picturing being able to mount an instance of the Page like so:
mountBookmarkablePage( "/redirector", new RedirectorPage(
SuccessPage.class, FailurePage.class ) );
... where the constructor for RedirectorPage look like:
public RedirectorPage( Class<? extends Page> responsePage, Class<?
extends Page> errorPage ) {}
I'm using Wicket's Spring-annotations so I could just inject a service
and get my 2 Pages from the service or put getters on the
WebApplication. Am I missing some better way to configure a WebPage?
I'm wondering why I can't mount an instance of a Page or pass params
to it when it is mounted.
Enrique
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]