Klasse SessionTool
java.lang.Object
org.apache.turbine.services.session.SessionTool
- Alle implementierten Schnittstellen:
ApplicationTool
A pull tool for accessing the SessionService from a velocity template.
- Version:
- $Id$
- Autor:
- Quinton McCombs
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addSession
(HttpSession session) Adds a session to the current list.Gets a list of the active sessionsGets a collection of all user objects representing the users currently logged in.getSessionsForUser
(User user) Get a collection of all session on which the given user is logged in.getUserFromSession
(HttpSession session) Gets the User object of the the specified HttpSession.void
Initialize the application tool.boolean
isUserLoggedIn
(User user) Determines if a given user is currently logged in.void
refresh()
Refresh the application tool.void
removeSession
(HttpSession session) Removes a session from the current list.
-
Konstruktordetails
-
SessionTool
public SessionTool()
-
-
Methodendetails
-
init
Beschreibung aus Schnittstelle kopiert:ApplicationTool
Initialize the application tool. The data parameter holds a different type depending on how the tool is being instantiated:- For global tools data will be null
- For request tools data will be of type RunData
- For session and authorized tools data will be of type User
It is possible that session scope tools will be initialized with a null
User
object. This happens when the first request on a session happens to the be login action.If your session tool depends on having a
User
object, you should look at implementing theRunDataApplicationTool
interface instead.- Angegeben von:
init
in SchnittstelleApplicationTool
- Parameter:
o
- initialization data
-
refresh
Beschreibung aus Schnittstelle kopiert:ApplicationTool
Refresh the application tool. This is necessary for development work where you probably want the tool to refresh itself if it is using configuration information that is typically cached after initialization- Angegeben von:
refresh
in SchnittstelleApplicationTool
-
getActiveSessions
Gets a list of the active sessions- Gibt zurück:
- List of HttpSession objects
-
addSession
Adds a session to the current list. This method should only be called by the listener.- Parameter:
session
- Session to add
-
removeSession
Removes a session from the current list. This method should only be called by the listener.- Parameter:
session
- Session to remove
-
isUserLoggedIn
Determines if a given user is currently logged in. The actual implementation of the User object must implement the equals() method. By default, Torque based objects (liek TurbineUser) have an implementation of equals() that will compare the result of getPrimaryKey().- Parameter:
user
- User to check for- Gibt zurück:
- true if the user is logged in on one of the active sessions.
-
getActiveUsers
Gets a collection of all user objects representing the users currently logged in. This will exclude any instances of anonymous user that Turbine will use before the user actually logs on.- Gibt zurück:
- collection of org.apache.turbine.om.security.User objects
-
getUserFromSession
Gets the User object of the the specified HttpSession.- Parameter:
session
- the session- Gibt zurück:
- the user from the session
-
getSessionsForUser
Get a collection of all session on which the given user is logged in.- Parameter:
user
- the user- Gibt zurück:
- Collection of HtttSession objects
-