I have configured the session expiration in my web.xml.
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/xxx.xhtml</location>
</error-page>
And in the .xhtml files its meta (in two, the rest of the files inherit from them):
<meta http-equiv="refresh" content="${pageContext.session.maxInactiveInterval};url=xxx.xhtml" />
In some pages the application works correctly (it is redirected to xxx.xhtml with an expiration warning message), but in many others the following exception is thrown and the application is dead, it gives an error in the log but the user cannot know that has happened, the application simply freezes.
javax.faces.application.ViewExpiredException: viewId:/[view where the error occurs] - View could not be restored /[view where the error occurs]
Is there a way to filter or catch this error when it occurs anywhere in the application?
I have placed a breakpoint in the method that is called by the view that throws the error and the application does not stop on it.
I have a filter
@WebFilter("*")
that is executed correctly when there is an active session and when it is not ignored.
I have found a considerable amount of information on Stackoverflow, but perhaps too cumbersome.
There is some way to capture this error "globally"?. Like a servlet filter captures a specific URL, something similar for an exception occurs wherever it occurs within the application.
Thanks greetings!