【问题标题】:PrettyFaces fails in Wildfly 8.1.0 but works in 8.0.0PrettyFaces 在 Wildfly 8.1.0 中失败,但在 8.0.0 中有效
【发布时间】:2014-09-27 16:38:45
【问题描述】:

当应用程序部署在 Wildfly 8.1.0.Final 上时,PrettyFaces 会在涉及重定向的每个请求上终止会话。相同的应用程序在 Wildfly 8.0.0.Final 上部署并正常运行。

在 8.1.0 上,PrettyFaces 似乎阻止 servlet 堆栈检索会话 ID。

在这两种情况下,日志均未显示异常。发生 URL 重写,但会话信息(包括登录信息)消失了。这是我的 pretty-config.xml

<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
                  http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">

<url-mapping id="user-settings">
    <pattern value="/protected/user/settings/"/>
    <view-id value="/protected/usersettings.xhtml"/>
</url-mapping>

<url-mapping id="thread-edit">
    <pattern value="/protected/threads/edit/#{stitchId}/" />
    <view-id value="/protected/threads/stitch.xhtml" />
    <action>#{stitchEditBean.editStitchFromId(stitchId)}</action>
</url-mapping>

<url-mapping id="threads-index">
    <pattern value="/protected/threads/" />
    <view-id value="/protected/threads/index.xhtml" />
</url-mapping>
</pretty-config>

PrettyFaces 2.0.12.Final 和 3.0.0.Alpha2 均出现故障

【问题讨论】:

  • 您使用的是哪个 PrettyFaces 版本?
  • 目前,3.0.0.Alpha2 但在 2.0.12.Final 上也失败了。

标签: jsessionid prettyfaces wildfly-8


【解决方案1】:

这是 WildFly 8.1.0 中的一个错误,在此解决:https://issues.jboss.org/browse/WFLY-3448

在您使用已修复该错误的版本后,您将需要使用 Rewrite 3.0.0.Alpha3 或更高版本来解决处理根上下文路径的其他问题。

【讨论】:

  • 正确。我在一两天前发现了这一点,忘了回来更新它。明确的解决方案/解决方法是在 web.xml 中添加一个 cookie 路径,而不是回复自动默认值。
【解决方案2】:

正如肯所说,根本问题与https://issues.jboss.org/browse/WFLY-3448有关

向 web.xml 添加显式 cookie 路径可以解决该问题并且是安全的。

<session-config>
    <session-timeout>30</session-timeout>
    <cookie-config>
        <!--
        A bug in wildfly 8.1.0.final requires this path to be set explicitly or occasionally the default is
        incorrect and the system will generate one cookie per directory incorrectly.
        -->
        <path>/</path>
    </cookie-config>
</session-config>

您可能必须手动清除应用程序每个目录中的不良 cookie,或刷新所有会话 cookie。否则旧的会话 cookie 可能会导致问题。

【讨论】:

    猜你喜欢
    • 2014-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多