0

I have an application with a logout button. After I doubleclick the button, I get a ViewExpiredException:

An unexpected exception was caught during processing the request:
javax.faces.application.ViewExpiredException: /faces/session-timeout.xhtml

My logout method has the following structure:

try {
    destroyBackendSession(); // this logs to be successful
} catch (InvalidArgumentException e) {
    logError(e);
} finally {
    try { 
        FacesContext.getCurrentInstance().getExternalContext().redirect(userBean.getPortalUrl());
    } catch (IOException e) {
        logError(e);
    }
    FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
}

No error is logged here, so it seems everything is working as expected here.

The bean is request scoped.

Potentially relevant config from my web.xml:

<context-param>
    <!-- Serialization and deserialization of the component tree is a major performance hit.  -->
    <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
    <param-value>false</param-value>
</context-param>
[...]
<error-page>
    <exception-type>javax.faces.application.ViewExpiredException</exception-type>
    <location>/faces/session-timeout.xhtml</location>
</error-page>

Ideally, I would like to redirect the user to the portal page after logout, not an error page. (See userBean.getPortalUrl() in the logout()-method above)

sinned
  • 503
  • 1
  • 7
  • 25

0 Answers0