Hi all,
I’m trying to implement a HttpSessionListener to obtain all sessions keys that are active on server i ussualy set:
public class HttpSessionCollector implements HttpSessionListener {
private static final Map<String, HttpSession> sessions = new HashMap<String, HttpSession>(); @Override
public void sessionCreated(HttpSessionEvent event) {
HttpSession session = event.getSession();
System.out.println("asd:"+session.getId());
sessions.put(session.getId(), session);
} @Override
public void sessionDestroyed(HttpSessionEvent event) {
sessions.remove(event.getSession().getId());
} public static HttpSession find(String sessionId) {
return sessions.get(sessionId);
} public static Map<String, HttpSession> getSessions() {
return sessions;
}
}
and set on web-custom.xml
<listener>
<listener-class>mypackage.HttpSessionCollector</listener-class>
</listener>
But this not work…
however i find this http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/javadoc/ org/jivesoftware/openfire/http/HttpSession.html
but im having no luck to use it