AuthenticationInterceptor
うーん.
色々参考にして,Teedaでログイン管理するために,AuthenticationInterceptorを
public class AuthenticationInterceptor implements MethodInterceptor { private S2Container container; private AuthenticationDto authenticationDto; public Class invoke(MethodInvocation invocation) throws Throwable { this.setAuthenticationDto(); if (this.getAuthenticationDto() == null || this.getAuthenticationDto().isAuthenticated() == false) { if(invocation.getClass().getName().matches("admin")){ return com.semcode.stuvie.web.admin.LoginPage.class; }else{ return com.semcode.stuvie.web.LoginPage.class; } } return (Class)invocation.proceed(); } //...snip... }
のように定義しているんだけれど,例えば
http://localhost:8080/stuvie/student/index.html
に認証されていない状態でアクセスすると,
[ETDA0107]HTML(/student/login.html)が見つかりません。
といわれてしまう.多分,com.semcode.stuvie.web.LoginPageに関連付けられたHTMLを同一サブアプリケーションで探してるからだと思うのだけれども.
そいやTeedaで,サブアプリケーションを定義する方法はないのかな.
いや,
+root |-admin | |-UsersList.html | |-UsersConfirm.html | |-UsersEdit.html | |-LecturesList.html | |-LecturesConfirm | |-LecturesEdit.html |-student |-Index.html |-ReportEdit.html
とかなっているのが気持ち悪くて.
+root |-admin | +-users | | |-UsersList.html | | |-UsersConfirm.html | | |-UsersEdit.html | +-lectures | |-LecturesList.html | |-LecturesConfirm | |-LecturesEdit.html +-student |-Index.html +-reports |-ReportEdit.html
ってしたいといつも思うんだけれど,そうするとサブアプリケーションとして認知してもらえないので,面倒くさいなぁとか.
あぁでも,値を持ちまわすな!って言われてるんだなきっと.
設計を見直せ!・・・はい・・・orz.
とりあえずログイン/ログアウトは要調査.