我正在使用Tuckey URLRewriteFilter。在我的应用程序中,我有以下页面和按钮:
inside.xhtml应用程序上下文中的页面: http ://example.com/app/inside.xhtmloutside.xhtml应用程序上下文之外的页面: http ://example.com/outside.xhtml- 页面http://example.com/app/login.xhtml
login.xhtml_ - A
login buttononoutside.xhtmlpage 转到该login.xhtml页面。 - 页面http://example.com/app/profile.xhtml
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.
2如果我一步一步地继续做,上述情况会反复发生7。
没有那个<rule>,我总是被profile.xhtml正确地重定向到成功登录的页面。
如果您能就这个问题给我一些建议,我将不胜感激。
更新:
在我的应用程序中,为了跟踪logged in状态,我有一个@SessionScoped托管 bean,其中包含一个记录状态的简单方法:
public void recordUserLoggedIn(HttpServletRequest request) {
HttpSession clientSession = request.getSession();
clientSession.setAttribute("isLogin", true);
}