Found out a valuable lesson about session management in Wicket today. Wicket tries to be as stateless as long as possible, I believe it takes some hints from how your pages are built to know if it needs to keep a Session around for longer than a Request.
So, if you find that newSession(Request request, Response response) is being called in your WebApplication class for each and every request (not somethng you want happening if you’re trying to keep state in the session between requests!) what you have to do is use the bind() method for the current session.
Using bind() can be done within the constructor of your custom Session class itself, or if you want more control over when Sessions persist, you can call bind selectively (i.e. only in the constructor of pages which use the Session to store/retrieve information intended to live between sessions).
e.g.
public class MyPage extends WebPage {
//...
public MyPage(String id) {
getSession().bind();
//setup wicket components
}
//...
}

