0

我有一个带有注销按钮的应用程序。双击按钮后,我得到一个ViewExpiredException

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

我的注销方法具有以下结构:

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();
}

这里没有记录错误,所以这里似乎一切都按预期工作。

bean 是请求范围的。

我的潜在相关配置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>

理想情况下,我想在注销后将用户重定向到门户页面,而不是错误页面。(参见userBean.getPortalUrl()上面的 logout() 方法)

4

0 回答 0