4 Replies Latest reply on Apr 10, 2007 4:27 PM by Patrick Madden

    Http Session Management into Seam

    paata lominadze Master

      is there any docs about it ?

      or i must use JSF HttpSessionListener ?


      Regards,
      Paata.

        • 1. Re: Http Session Management into Seam
          paata lominadze Master

          anybody knows about it ?

          • 2. Re: Http Session Management into Seam
            Stuart Robertson Novice

            What specifically are you looking to do?

            Seam doesn't have much in the way of session-specific management, at least that I'm aware of. Session is just one of the available contexts.

            • 3. Re: Http Session Management into Seam
              paata lominadze Master

              hi stu2
              for user identification on my system i use org.jboss.seam.security.Identity class,

              i need that after 10 minutes system outomatically logged out and go to my ligin page.

              i know how to destroy session by HttpSessionListener implementation but how i can redirect into login page and how to say Identity class to logout ?


              Regards,
              Paata

              • 4. Re: Http Session Management into Seam
                Patrick Madden Newbie

                Regarding Session, you should look into the code of SeamListener.java and Lifecycle.java

                I had similar issues with knowing when a session context actually became active in my components. I found the @Create annotation that you can use inside of you SFSB components that have Session Scope. You put this above a method and that method will be called when Seam fully creates your sessioned component. For example:

                 /**
                 * This method is called after this component has been successfully
                 * instantiated by the Seam framework
                 */
                 @Create
                 public void create()
                 {
                 log.info("WebDocumentTreeModelBean create method called");
                
                 if (Contexts.isSessionContextActive())
                 {
                 // do what ever you need to do once your session is active
                 }
                 else
                 {
                 log.info("SessionContext is still not active after component creation event");
                 }
                 }


                You would also need to define the public void create() method in your local interface but I found this useful. I never knew exactly when Contexts.isSessionContextActive() was valid until I found this annotation.

                Hope this helps.