Example usage for javax.servlet.http HttpSessionEvent getSession

List of usage examples for javax.servlet.http HttpSessionEvent getSession

Introduction

In this page you can find the example usage for javax.servlet.http HttpSessionEvent getSession.

Prototype

public HttpSession getSession() 

Source Link

Document

Return the session that changed.

Usage

From source file:gov.nih.nci.ncicb.cadsr.umlmodelbrowser.servlets.SessionListener.java

public void sessionCreated(HttpSessionEvent se) {
    if (log.isDebugEnabled()) {
        log.debug("New UML Browser session " + se.getSession().getId() + " is created");
    }// ww w .j a v  a2s.co  m
    UMLBrowserParams.reloadInstance();
    return;
}

From source file:nl.b3p.web.SharedSessionData.java

public void sessionDestroyed(HttpSessionEvent event) {
    log.debug("removing data for session: " + event.getSession().getId());
    sessions.remove(event.getSession().getId());
}

From source file:org.spirit.spring.BotListUserSessionListener.java

private ApplicationContext getWebApplicationContext(HttpSessionEvent httpSessionEvent) {
    final HttpSession session = httpSessionEvent.getSession();
    final ServletContext sc = session.getServletContext();
    return (ApplicationContext) sc.getAttribute(CONTEXT_BOTLIST);
}

From source file:leon.ssi.util.session.AppSessionListener.java

public void sessionDestroyed(HttpSessionEvent se) {
    try {//w  w w . j  av  a2 s .co m
        HttpSession session = se.getSession();
        String userId = "";
        UserSessionInfo userSession = null;
        try {
            userSession = (UserSessionInfo) session.getAttribute("UserSessionInfo");
            session.removeAttribute("UserSessionInfo");
        } catch (Exception sex) {
        }
        session.invalidate();
        logger.info("session destroy");
    } catch (Exception e) {

    }
}

From source file:gov.nih.nci.ncicb.cadsr.cdebrowser.servlets.CDEBrowserSessionListener.java

public void sessionDestroyed(HttpSessionEvent se) {
    if (log.isDebugEnabled()) {
        CDECart cart = (CDECart) se.getSession().getAttribute(CaDSRConstants.CDE_CART);
        if (cart != null) {
            cart.expireCart();/* ww  w.j a v a  2  s. co m*/
        }
        log.info("Object Cart with userId: PublicUser" + se.getSession().getId() + " set for expiration");
        log.debug("Session " + se.getSession().getId() + " is about to be destroyed.");
    }
}

From source file:edu.stanford.muse.webapp.SessionListener.java

public void sessionDestroyed(HttpSessionEvent event) {
    log.info("Destroying session: " + event.getSession().getId() + " at " + new Date());
    HttpSession session = event.getSession();

    if (ModeConfig.isDiscoveryMode())
        log.info("Not saving archive on session destroy because we're in discovery mode");
    else {//from w ww .j  a v  a  2s.  co  m
        // save the archive before quitting the session, so the annotations, flags, etc. can be saved
        Archive archive = (Archive) session.getAttribute("archive");
        if (archive != null)
            try {
                SimpleSessions.saveArchive(session);
            } catch (Exception e) {
                Util.print_exception(e, log);
                return;
            }
    }
    synchronized (this) {
        sessionCount--;
        log.info("Current number of sessions: " + sessionCount);
    }
}

From source file:SessionLogger.java

public void sessionCreated(HttpSessionEvent se) {

    //log request of the INFO level
    log.info("HttpSession created: " + se.getSession().getId());

}

From source file:gov.nih.nci.cma.util.CmaSessionListener.java

public void sessionDestroyed(HttpSessionEvent event) {
    String sessionId = event.getSession().getId();
    System.out.println("Session destroyed cleaning cache for id=" + sessionId);

    BusinessCacheManager.getInstance().removeSessionCache(sessionId);

    Collection<Task> allTasks = PresentationCacheManager.getInstance().getAllSessionTasks(sessionId);
    BusinessCacheManager.getInstance().removeSessionCacheForTasks(allTasks);

    PresentationCacheManager.getInstance().removeSessionCache(sessionId);

    String gpUser = (String) event.getSession().getAttribute(PublicUserPool.PUBLIC_USER_NAME);
    PublicUserPool pool = (PublicUserPool) event.getSession().getAttribute(PublicUserPool.PUBLIC_USER_POOL);

    if (gpUser != null && pool != null) {
        pool.returnPublicUser(gpUser);//from   www. j  a v  a 2s  . com
    }

    //clean up the temp files associated with this session
    String tmpDirStr = System.getProperty("java.io.tmpdir");
    System.out.println("Deleting files in tmpDir=" + tmpDirStr + " for session=" + sessionId);
    File tmpDir = new File(tmpDirStr);
    String[] tmpFiles = tmpDir.list();
    for (int i = 0; i < tmpFiles.length; i++) {
        String fileName = tmpFiles[i];
        if (fileName.startsWith(sessionId)) {
            //delete the file
            String fileNameToDelete = tmpDir + System.getProperty("file.separator") + fileName;
            try {
                File fileToDelete = new File(fileNameToDelete);
                System.out.println("Deleting file: " + fileNameToDelete);
                fileToDelete.delete();
            } catch (Exception ex) {
                log.error(ex);
            }
        }
    }
}

From source file:ispok.helper.SessionListener.java

@Override
public void sessionDestroyed(HttpSessionEvent hse) {

    logger.entry();/*from ww  w.j  a  va  2 s.c o  m*/
    logger.debug("Session destroyed: {}", hse.getSession().toString());

    //        Enumeration<String> attributeNames = hse.getSession().getAttributeNames();
    //        logger.debug("Attributes: ");
    //        while (attributeNames.hasMoreElements()) {
    //            logger.debug(attributeNames.nextElement());
    //        }
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

    if (authentication != null) {
        logger.debug("Username: {}", authentication.getName());
    }

    logger.exit();
}