Details
Description
JavaEE applications can specify a location for the container to redirect to when an exception is detected on the server. This is done in the web.xml using:
<error-page>
<exception-type>org.mycompany.myproduct.MyException</exception-type>
<location>error.html</location>
</error-page>>
However, this does not work when using JSF with Ajax. Any exceptions are propagated back to the client as part of the Ajax response so the container never sees them.
ICEfaces has a feature where you can specify a context parameter:
<context-param>
<param-name>org.icefaces.sessionExpiredRedirectURI</param-name>
<param-value>error.html</param-value>
</context-param>
However, this only applies to a single use case. If the exception is not specifically an org.icefaces.application.SessionExpiredException, nothing will happen. This can be a problem if a session expiry leads to a different exception. I recommend looking atICE-9224 for additional details about this issue.
This JIRA recommends that the current ICEfaces feature be expanded to allow developers to declare multiple exceptions and redirection locations - basically providing the same functionality as error-page declarations but that would work with Ajax responses.
<error-page>
<exception-type>org.mycompany.myproduct.MyException</exception-type>
<location>error.html</location>
</error-page>>
However, this does not work when using JSF with Ajax. Any exceptions are propagated back to the client as part of the Ajax response so the container never sees them.
ICEfaces has a feature where you can specify a context parameter:
<context-param>
<param-name>org.icefaces.sessionExpiredRedirectURI</param-name>
<param-value>error.html</param-value>
</context-param>
However, this only applies to a single use case. If the exception is not specifically an org.icefaces.application.SessionExpiredException, nothing will happen. This can be a problem if a session expiry leads to a different exception. I recommend looking at
This JIRA recommends that the current ICEfaces feature be expanded to allow developers to declare multiple exceptions and redirection locations - basically providing the same functionality as error-page declarations but that would work with Ajax responses.
Implemented redirect on exception feature. The URLs used for redirection can be absolute or relative. The relative URLs are resolved by ViewHandler.getResourceURL method.