Omnifaces 2.0, Primefaces 5, wildFly 8.2
After session timeout if I try to make an ajax call with registered FullAjaxExceptonHandler
in browser will be shown xml response and not the rendered error page.
The similiar error comes if PrimeExceptionHandler
is used. If both excepton handlers are removed the similiar incorrect output in browser and exception comes. See EDIT browser output.
EDIT 2 If the rows in web.xml
are changed to "JSP" Login
<form-login-page>/login/login.jsp</form-login-page>
<form-error-page>/login/login.jsp</form-error-page>
then AjaxExceptionHandler is not called.
login.xhtml is very similiar to https://stackoverflow.com/a/2207147/2023524 . Only with RequestScope and stateless view.
output in browser:
<partial-response id="j_id1"><changes><update id="javax.faces.ViewRoot"><html xmlns="http://www.w3.org/1999/xhtml">
text of ErrorHandlerViewExpired.xhtml ...
</html></update><update id="j_id1:javax.faces.ViewState:0">stateless</update></changes></partial-response>
web.xml:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>app</realm-name>
<form-login-config>
<form-login-page>/login/login.xhtml</form-login-page>
<form-error-page>/login/login.xhtml</form-error-page>
</form-login-config>
</login-config>
<error-page>
<error-code>500</error-code>
<location>/errors/errorHandlerWeb.xhtml?faces-redirect=true</location>
</error-page>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/errors/errorHandlerViewExpired.xhtml?faces-redirect=true</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/errors/errorHandlerProg.xhtml</location>
</error-page>
faces-config.xml:
<factory>
<exception-handler-factory>
org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory
</exception-handler-factory>
</factory>
Console:
FullAjaxExceptionHandler: An exception occurred during processing JSF ajax request. Error page '/errors/errorHandlerViewExpired.xhtml?faces-redirect=true' will be shown.: javax.faces.application.ViewExpiredException: viewId:/login/login.xhtml - Ansicht /login/login.xhtml konnte nicht wiederhergestellt werden.
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:212) [jsf-impl-2.2.11.jar:2.2.11]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.11.jar:2.2.11]
EDIT
Output in browser without some ajaxExceptionHandler:
<partial-response id="j_id1">
<redirect url="/app/pageWithAjax.jsf"/>
<error>
<error-name>class javax.faces.application.ViewExpiredException</error-name>
<error-message>viewId:/login/login.xhtml - Ansicht /login/login.xhtml konnte nicht wiederhergestellt werden.
</error-message></error></partial-response>