*Navigation trail:* [TurbineProjectPages] - [JakartaTurbine2] - [Development|JakartaTurbine2 SessionService Development] - [Proposals|JakartaTurbine2 SessionService Proposals] - [SessionService|JakartaTurbine2 SessionService SessionService]
----
h1. 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!!!!*
h2. 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.
h2. Functionality
Here is the javadocs from the interface for the [SessionService].
{noformat} /**
* Gets all active sessions
*
* @return Collection of HttpSession objects
*/
public Collection getActiveSessions(); {noformat}
{noformat} /**
* Adds a session to the current list
* @param session Session to add
*/
public void addSession(HttpSession session); {noformat}
{noformat} /**
* Removes a session from the current list
* @param session Session to remove
*/
public void removeSession(HttpSession session); {noformat}
{noformat} /**
* 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 ); {noformat}