Hi!

I would like to ignore "page expired" on certain pages. What I mean is
that in general it is ok to follow the instruction:

getApplicationSettings().setPageExpiredErrorPage(LoginPage.class);

However, on certain pages where the session is not so important, I
would like to redirect back to the ongoing page (without
RestartResponseException) because there is no harm (I can check some
@SafeExpired annotation or something, to make sure).

I found the following piece from AbstractRequestCycleProcessor:
if (e instanceof PageExpiredException)
{
  Class<? extends Page> pageExpiredErrorPageClass =
application.getApplicationSettings()
     .getPageExpiredErrorPage();
  boolean mounted = isPageMounted(pageExpiredErrorPageClass);
  RequestCycle.get().setRedirect(mounted);
  throw new RestartResponseException(pageExpiredErrorPageClass);
}

I could extend WebRequestCycleProcessor and override the method public
void respond(RuntimeException e, RequestCycle requestCycle); with the
intention of Catching the RestartResponseException and analyzing
whether the target page meets the special conditions. If it does meet,
I consume the RestartResponseException...

Will this do the trick properly? Is this a good approach? Anybody done
this before?

It feels a bit like hacking into the wicket bloodlines, if the
internals change the hack might not work in the future. Is there a
more proper way to do this or should there be a new feature in Wicket
to support selecting which pages care about expiration (or maybe there
already is?)? These pages in question have only some plain forms and
do not require login. Now if such a page expires, it redirects to
login, which is really not the purpose.

**
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to