Search in sources :

Example 1 with SessionManager

use of org.openforis.collect.manager.SessionManager in project collect by openforis.

the class SessionListener method sessionCreated.

@Override
public void sessionCreated(HttpSessionEvent se) {
    SessionManager sessionManager = getSessionManager(se);
    sessionManager.createSessionState(se.getSession());
    if (LOG.isInfoEnabled()) {
        LOG.info("Session created: " + se.getSession().getId());
    }
}
Also used : SessionManager(org.openforis.collect.manager.SessionManager)

Example 2 with SessionManager

use of org.openforis.collect.manager.SessionManager in project collect by openforis.

the class SessionListener method sessionDestroyed.

@Override
public void sessionDestroyed(HttpSessionEvent se) {
    SessionManager sessionManager = getSessionManager(se);
    try {
        SessionState sessionState = sessionManager.getSessionState();
        User user = null;
        if (sessionState != null) {
            user = sessionState.getUser();
            if (user != null) {
                sessionManager.sessionDestroyed();
            }
        }
        if (LOG.isInfoEnabled()) {
            String message = "Session destroyed: " + se.getSession().getId();
            if (user != null) {
                message += " username: " + user.getUsername();
            }
            LOG.info(message);
        }
    } catch (InvalidSessionException e) {
    // ignore it, session was anonymous
    }
}
Also used : InvalidSessionException(org.openforis.collect.web.session.InvalidSessionException) SessionState(org.openforis.collect.web.session.SessionState) User(org.openforis.collect.model.User) SessionManager(org.openforis.collect.manager.SessionManager)

Aggregations

SessionManager (org.openforis.collect.manager.SessionManager)2 User (org.openforis.collect.model.User)1 InvalidSessionException (org.openforis.collect.web.session.InvalidSessionException)1 SessionState (org.openforis.collect.web.session.SessionState)1