2 Replies Latest reply on Feb 25, 2008 9:27 PM by ziphyre

    Observer("org.jboss.seam.security.loginSuccessful") method called two times

    ziphyre

      Hi,


      Since there is no guarantee on how many times the authenticator method will be called, I created a observer method, defined another class for it UserStatsManager and declared it in components.xml and here it is:


      components.xml:


      <event type="org.jboss.seam.security.loginSuccessful">
          <action execute="#{userStatsManager.postLogin}"/>
          <action execute="#{redirect.returnToCapturedView}"/>  
      </event>



      UserStatsManager.java:


      @In @Out User user;    
              
          @Observer("org.jboss.seam.security.loginSuccessful")
          public void postLogin()
          {           
              int count = user.getLoginCount();
              user.setLastLogin(new java.util.Date());
              user.setLoginCount(count + 1);
          }



      The problem is my loginCount field always augments by 2. I looked it with println's and it's really called two times.
      Any suggestion?


      Thanks