Hi
I am new to wicket and have run into a problem in the development of my
application. The problem has a few workarounds, but I am afraid it is
pointing to a far larger gap in my understanding of Wicket. If anyone can
tell my what is going on here, I will be *very* grateful. I put together a
test app to illustrate:
public class TestPage1 extends TestBasePage
{
public TestPage1()
{
User user = MySession.get().getUser();
String userDescription = (user == null? "No User" :
user.toString());
add(new Link("login")
{
@Override
public void onClick()
{
MySession.get().setUser(new User(1, "Mr", "T", "Test",
"t...@test.com", "12", "test", "test"));
setResponsePage(getApplication().getHomePage());
}
@Override
public boolean isVisible()
{
return !MySession.get().isAuthenticated();
}
});
add(new Label("user", userDescription));
//add(new Link("logout")
//{
//@Override
//public void onClick()
//{
//MaiaSession.get().invalidate();
//setResponsePage(getApplication().getHomePage());
//}
//
//@Override
//public boolean isVisible()
//{
//return MySession.get().isAuthenticated();
//}
//});
add(new BookmarkablePageLink("logout", TestLogoutPage.class)
{
@Override
public boolean isVisible()
{
boolean result = MySession.get().isAuthenticated();
return result;
}
});
}
}
The TestLogoutPage is very simple:
public class TestLogoutPage extends BasePage
{
public TestLogoutPage()
{
MySession.get().invalidate();
setResponsePage(getApplication().getHomePage());
}
}
If I use the commented out code for the logout link, it works as expected.
If, however, I use the BookmarkableLink to the TestLogoutPage, the
application breaks. If I click "logout", the page doesn't refresh unless I
do it manually (F5). If I click logout again, then the page refreshes, but
any subsequent clicks (of either login or logout) give me a Page Expired
message.
I dont understand
1. Why the Bookmarkable page version isn't working and
2. Why the pages expire if I call logout multiple times.
--
View this message in context:
http://www.nabble.com/A-massive-flaw-in-my-understanding-of-Wicket-tp22369056p22369056.html
Sent from the Wicket - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org