【发布时间】:2013-02-26 22:14:04
【问题描述】:
我正在使用Tuckey URLRewriteFilter。在我的应用程序中,我有以下页面和按钮:
- 页面
inside.xhtml在应用程序的上下文中:http://example.com/app/inside.xhtml - 页面
outside.xhtml在应用程序上下文之外:http://example.com/outside.xhtml - 页面
login.xhtmlhttp://example.com/app/login.xhtml -
login button在outside.xhtml页面上转到login.xhtml页面。 - 页面
profile.xhtmlhttp://example.com/app/profile.xhtml -
logout button在profile.xhtml页面上转到inside.xhtml页面。
在umlrewrite.xhtml 文件中,我有以下规则从inside.xhtml 重定向到outside.xhtml:
<rule>
<note>
Requests to /app/inside.xhtml will be redirected to ./../../outside.html
</note>
<from>/app/inside.xhtml</from>
<to type="redirect">./../../outside.html</to>
</rule>
我的逻辑是用户在login.xhtml页面登录后,会被重定向到profile.xhtml页面。我期望发生的是以下流程:
- 浏览至
outside.xhtml。 - 点击
login button进入login.xhtml并登录。 - 登录成功后到达
profile.xhtml。 - 点击
logout button转至inside.xhtml。 - 被重定向到
outside.xhtml。
然而,实际发生的是:
- 浏览至
outside.xhtml。 - 点击
login button进入login.xhtml并登录。 - 突然被重定向回
outside.xhtml。 - 点击
login button转到login.xhtml并再次登录(该应用没有记录我的登录)。 - 登录成功后到达
profile.xhtml。 - 点击
logout button转至inside.xhtml。 - 被重定向到
outside.xhtml。
如果我在步骤7 之后继续执行步骤2,则会重复出现上述情况。
没有<rule>,我总是在成功登录时被重定向到profile.xhtml 页面。
如果您能就这个问题给我一些建议,我将不胜感激。
更新:
在我的应用程序中,为了跟踪 logged in 状态,我有一个 @SessionScoped 托管 bean,其中包含一个记录状态的简单方法:
public void recordUserLoggedIn(HttpServletRequest request) {
HttpSession clientSession = request.getSession();
clientSession.setAttribute("isLogin", true);
}
【问题讨论】:
标签: java jsf-2 url-rewriting tuckey-urlrewrite-filter