Wicket Homepage Redirecting
With the Wicket Java Web framework where a lot of magic happens behind the scenes, and almost no XML needs to be configured. Most of it is done with Java. It has a lot of pretty cool features. I just came across this one.
In the init setup of your class that extends WebApplication, you can "mount" your pages at paths, like this:
@Override protected void init() { super.init(); mountBookmarkablePage("/search", SearchPage.class); }
So when you goto http://somewhere.com/somecontext/search, it gives you the SearchPage class.
You can also specify a HomePage index, like this:
public Class extends Page> getHomePage() { return IndexPage.class; }
Then when you goto http://somewhere.com/somecontext/, it gives you the IndexPage class.
The cool subtle thing here is what happens when you do them both; i.e. you mount SearchPage to /search, and you override getHomePage to return SearchPage.class. Do this, and when you goto http://somewhere.com/somecontext/, it will redirect to http://somewhere.com/somecontext/search!