0
votes

I have a p:commandButton on a page. When the session times out and I click on it nothing happens. Nothing appears on the logs and the action is not called.

I have read this post and this post about the subject. So I've created an ExceptionHandler with the following code:

Throwable exc = null;
for (final Iterator<ExceptionQueuedEvent> it = getUnhandledExceptionQueuedEvents().iterator(); it.hasNext();) {
    exc = it.next().getContext().getException();
}
return exc;

in order to get the exception and redirect the user to an error page. However, the iterator is always empty, so excis always null...

1

1 Answers

0
votes

I have found out the what the problem was.

Actually the request was being intercepted by an authentication filter. The filter couldn't find the user in the session, since it was expired, and was trying to redirect the user to the login page.

As my filter was using HttpServletResponse#sendRedirect and this does not work on Ajax calls, nothing was really happening.

This (another) perfect answer by BalusC showed me the way. So, problem solved!