2 Replies Latest reply on Aug 17, 2007 6:57 AM by Samuel Mendenhall

    add my own interceptor with problems

    dazhu tang Newbie

      1.I want to add my own login interceptor in my application,the following is my
      interceptor class

      public class LoggedInInterceptor {
      @Logger
      private Log log;

      @AroundInvoke
      public Object checkLoggedIn(InvocationContext invocation) throws Exception {

      boolean isLoggedIn = Contexts.getSessionContext().get("user_status") != null;
      if (isLoggedIn) {
      // the user is already logged in
      log.info("Login interceptor is invoked!", null);
      return invocation.proceed();
      } else {

      // the user is not logged in, fwd to login page
      return "login";
      }
      }

      }

      2.i want to use this interceptor in my managed bean

      @Scope(CONVERSATION)
      @Name("longCardQueryAction")
      @Interceptors(LoggedInInterceptor.class)
      public class LongCardQueryAction extends BaseBean {....}

      but it seems that that interceptor doesn't work, can anyone tell me what's wrong with my problem?

      I just guess i need to config this interceptor in some place ,but i don't know where it is.