Navigation trail: TurbineProjectPages - JakartaTurbine2 - Development - Proposals - SessionService
New Session Service
I posted a message to the list a while back asking for a way to access the session information from the container. The response was that there was no way to do it with Turbine yet.
I have now written a service that allows access to all sessions for the current context. I was hoping to get some feedback on how it works and what it can do before I add it into the Turbine source tree.... If you have any ideas for additional functionality, please make notes at the end of this page!!!!
How it works
I have a listener class that is configured in web.xml to listener for session creation and destruction events. Upon creation or destruction of a session, the session object is passed to the { { { SessionService } } }. This approach work on any container that support the servlet 2.3 API.
Functionality
Here is the javadocs from the interface for the SessionService.
{{{ /**
- Gets all active sessions
@return Collection of HttpSession objects
- /
- public Collection getActiveSessions(); }}}
{{{ /**
- Adds a session to the current list
- @param session Session to add
- /
public void addSession(HttpSession session); }}}
{{{ /**
- Removes a session from the current list
- @param session Session to remove
- /
public void removeSession(HttpSession session); }}}
{{{ /**
- Determines if a given user is currently logged in
- @param user User to check for
- @return true id the user is logged in on one of the
- active sessions.
- /
- public boolean isUserLoggedIn( User user ); }}}