Would it be considered bad practice to use a Wicket page as an action? i.e.
it doesn't do anything but perform some particular action (e.g. logout) and
then forward onto another page.
I'm coming up, again, against my biggest annoyance with Wicket - URLs. I
want to create a logout function in my application and so have created a
logout link component:
public class LogoutLink extends Link<Void>
{
public LogoutLink( String id )
{
super( id );
}
@Override
public void onClick()
{
AuthenticatedWebSession session = AuthenticatedWebSession.get();
session.signOut();
setResponsePage( LogoutPage.class );
}
}
When I put this component within a page (in my case, an AccessDeniedPage),
as the AccessDeniedPage will handle the request, the URL for logging out is:
http://localhost:8080/web/?wicket:interface=:3:logout::ILinkListener::
I don't see the need to expose implementation details (i.e. ?wicket in the
URL) at this point. Therefore, does it make more sense that the LogoutPage
(the response page) itself performs the logout action? The link for logging
out would then simply become a bookmarkable link to the logout page. For
some reason, this doesn't really feel right to me, though.
I'd much rather keep the functionality as is and, instead, have the URL
disguised. I do understand the basics of URL mounting and encoding but don't
understand how I can use it to disguise this particular scenario.
Regards,
Andrew