Interceptorでひとはまり。
ログイン認証をInterceptor使ってやろうとしてはまった。
//クラス名はAuthenticateの方がしっくりくるかもなぁ。認証チェックだし。 public class LogonInterceptor implements MethodInterceptor { private SessionDto sessionDto; public Object invoke(MethodInvocation invocation) throws Throwable { if (sessionDto == null || sessionDto.isAuthenticated() == false) { //MEMO Interceptor の場合はsubapp_pageの文字列表現で返さないとだめみたい。 return "index_logon"; } return invocation.proceed(); } public void setSessionDto(SessionDto sessionDto) { this.sessionDto = sessionDto; } }
コメントで書いてあるけど、最初はLogonPage.classと書いていたのだけれど、それだとどうも動かないご様子。diconの設定がわるいのか?とか思いつつあれこれ試行錯誤してみても駄目。まさかねーと思って、"index_logon"とString表現に変えてあげたらあっさり動く始末orz
まぁ、小難しく試すんではなくBasicからやりましょうって話でした。