Tuckey URLRewriteFilterを使用しています。私のアプリケーションには、次のページとボタンがあります。
inside.xhtml
アプリのコンテキスト内にあるページ: http://example.com/app/inside.xhtmloutside.xhtml
アプリのコンテキスト外のページ: http://example.com/outside.xhtml- http://example.com/app/login.xhtml
login.xhtml
のページ - ページに移動するためのページ
login button
上の A。outside.xhtml
login.xhtml
- http://example.com/app/profile.xhtml
profile.xhtml
のページ - ページに移動するためのページ
logout button
上の A。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);
}