3 Replies Latest reply on Jan 12, 2010 5:40 PM by Walter White

    logged in userlist

    Sascha Janz Master

      how can i get a list of currently logged in users?

        • 1. Re: logged in userlist
          Duncan Stockdill Newbie

          There's a few ways to do this, but possibly the easiest option is to follow the wiki example in the seam distribution. 

          WikiServletListener keeps track of current user sessions

          WikiHttpSessionManager and sessionManager.xhtml provide a view for monitoring sessions and associated logged in users.

          • 2. Re: logged in userlist
            Coral Featherstone Newbie

            These classes don't seem to be in the latest version of seam. Have they been renamed?
            I also need this functionality.

            • 3. Re: logged in userlist
              Walter White Novice


              Theoretically ...

              1. get the active application context

              2. get all active sessions

              3. with all the active sessions, you should be able to get a session context

              4. with the session context, you should be able to get an identity

              Otherwise, in my application, I store everything in the database, so I can simply query it as needed:

              SELECT * FROM HttpSession s WHERE s.user_id IS NOT NULL

              My query would be a bit different than that.  I store the date/time in the http request, so I would have to do an inner join on that entity:

                HttpSession s
                INNER JOIN HttpRequest r ON r.httpSession_id = s.id
                s.user_id IS NOT NULL

              The date diff is psuedo code, that may be the right function, it may not, it may take different parameters.

              Let me know if that works, I'd am curious to know especially since it can be useful for other things.