|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gisgraphy.webapp.listener.UserCounterListener
public class UserCounterListener
UserCounterListener class used to count the current number of active users for the applications. Does this by counting how many user objects are stuffed into the session. It Also grabs these users and exposes them in the servlet context.
Field Summary | |
---|---|
static String |
COUNT_KEY
Name of user counter variable |
static String |
EVENT_KEY
The default event we're looking to trap. |
static String |
USERS_KEY
Name of users Set in the ServletContext |
Constructor Summary | |
---|---|
UserCounterListener()
|
Method Summary | |
---|---|
void |
attributeAdded(javax.servlet.http.HttpSessionBindingEvent event)
This method is designed to catch when user's login and record their name |
void |
attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
When user's logout, remove their name from the hashMap |
void |
attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
Needed for Acegi Security 1.0, as it adds an anonymous user to the session and then replaces it after authentication. |
void |
contextDestroyed(javax.servlet.ServletContextEvent event)
Set the servletContext, users and counter to null |
void |
contextInitialized(javax.servlet.ServletContextEvent sce)
Initialize the context |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String COUNT_KEY
public static final String USERS_KEY
public static final String EVENT_KEY
Constructor Detail |
---|
public UserCounterListener()
Method Detail |
---|
public void contextInitialized(javax.servlet.ServletContextEvent sce)
contextInitialized
in interface javax.servlet.ServletContextListener
sce
- the eventpublic void contextDestroyed(javax.servlet.ServletContextEvent event)
contextDestroyed
in interface javax.servlet.ServletContextListener
event
- The servletContextEventpublic void attributeAdded(javax.servlet.http.HttpSessionBindingEvent event)
attributeAdded
in interface javax.servlet.http.HttpSessionAttributeListener
event
- the event to processHttpSessionAttributeListener.attributeAdded(javax.servlet.http.HttpSessionBindingEvent)
public void attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
attributeRemoved
in interface javax.servlet.http.HttpSessionAttributeListener
event
- the session binding eventHttpSessionAttributeListener.attributeRemoved(javax.servlet.http.HttpSessionBindingEvent)
public void attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
attributeReplaced
in interface javax.servlet.http.HttpSessionAttributeListener
event
- the session binding eventHttpSessionAttributeListener.attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |