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:org.acegisecurity.ui.session.HttpSessionEventPublisher.java

/**
 * Handles the HttpSessionEvent by publishing a {@link HttpSessionDestroyedEvent} to the application
 * appContext.// w w w .ja v  a 2s  .co m
 *
 * @param event The HttpSessionEvent pass in by the container
 */
public void sessionDestroyed(HttpSessionEvent event) {
    HttpSessionDestroyedEvent e = new HttpSessionDestroyedEvent(event.getSession());

    if (log.isDebugEnabled()) {
        log.debug("Publishing event: " + e);
    }

    getContext(event.getSession().getServletContext()).publishEvent(e);
}

From source file:com.medlog.webservice.lifecycle.NewServletListener.java

@Override
public void sessionDestroyed(HttpSessionEvent _se) {
    Integer activeUsers = (Integer) _se.getSession().getServletContext().getAttribute("activeLogins");
    if (activeUsers == null) {
        LOG.warning("Active Users NULL!");
        activeUsers = 0;/*from   w ww.  j  a v  a 2s. c  o  m*/
    } else {
        activeUsers--;
    }
    _se.getSession().getServletContext().setAttribute("activeLogins", activeUsers);
    LOG.info("$$$$$$$$ com.medlog.webservice.lifecycle.NewServletListener.sesionDestroyed()");
    System.out.println(
            "$$$$$$$$ com.medlog.webservice.lifecycle.NewServletListener.sessionDestoyed() Users online: "
                    + activeUsers);

}

From source file:org.springframework.security.web.session.HttpSessionEventPublisher.java

/**
 * Handles the HttpSessionEvent by publishing a {@link HttpSessionCreatedEvent} to the
 * application appContext.//from  w  w w  . j  av a2s .c  om
 *
 * @param event HttpSessionEvent passed in by the container
 */
public void sessionCreated(HttpSessionEvent event) {
    HttpSessionCreatedEvent e = new HttpSessionCreatedEvent(event.getSession());
    Log log = LogFactory.getLog(LOGGER_NAME);

    if (log.isDebugEnabled()) {
        log.debug("Publishing event: " + e);
    }

    getContext(event.getSession().getServletContext()).publishEvent(e);
}

From source file:be.fedict.eid.dss.webapp.TempFileCleanerHttpSessionListener.java

@Override
public void sessionDestroyed(HttpSessionEvent event) {
    LOG.debug("sessionDestroyed");
    HttpSession httpSession = event.getSession();
    Set<String> tmpFileSet = (Set<String>) httpSession
            .getAttribute(ModelDSSDocumentContext.TMP_FILE_SET_SESSION_ATTRIBUTE);
    if (null == tmpFileSet) {
        LOG.debug("no temp file set in HTTP session present");
        return;/*  w ww.  j ava  2s .  c o  m*/
    }
    for (String tmpFilename : tmpFileSet) {
        File tmpFile = new File(tmpFilename);
        if (false == tmpFile.exists()) {
            LOG.debug("tmp file already removed: " + tmpFilename);
            continue;
        }
        if (tmpFile.delete()) {
            LOG.debug("tmp file successfully deleted: " + tmpFilename);
        } else {
            LOG.warn("tmp file could not be removed: " + tmpFilename);
        }
    }
}

From source file:com.medlog.webservice.lifecycle.NewServletListener.java

@Override
public void sessionCreated(HttpSessionEvent _se) {
    Integer activeUsers = (Integer) _se.getSession().getServletContext().getAttribute("activeLogins");
    if (activeUsers == null) {
        LOG.warning("Active Users NULL!");
        activeUsers = 1;//from w  w  w . java 2  s. c o  m
    } else {
        activeUsers++;
    }

    _se.getSession().getServletContext().setAttribute("activeLogins", activeUsers);

    LOG.warning("\n$$$$$$$$ com.medlog.webservice.lifecycle.NewServletListener.sesionCreated()");
    System.out.println(
            "\n$$$$$$$$ com.medlog.webservice.lifecycle.NewServletListener.sessionCreated() Users online: "
                    + activeUsers);

}

From source file:org.springframework.security.web.session.HttpSessionEventPublisher.java

/**
 * Handles the HttpSessionEvent by publishing a {@link HttpSessionDestroyedEvent} to
 * the application appContext./*www .ja  va 2s  . c o  m*/
 *
 * @param event The HttpSessionEvent pass in by the container
 */
public void sessionDestroyed(HttpSessionEvent event) {
    HttpSessionDestroyedEvent e = new HttpSessionDestroyedEvent(event.getSession());
    Log log = LogFactory.getLog(LOGGER_NAME);

    if (log.isDebugEnabled()) {
        log.debug("Publishing event: " + e);
    }

    getContext(event.getSession().getServletContext()).publishEvent(e);
}

From source file:org.carewebframework.ui.HttpSessionListener.java

/**
 * @see org.zkoss.zk.ui.http.HttpSessionListener23#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
 *//*from  w  ww.  j a v a  2s. c om*/
@Override
public void sessionDestroyed(final HttpSessionEvent event) {
    log.info(
            String.format("Native HttpSession Destruction Event : %s : %s", event.getSession().getId(), event));
    super.sessionDestroyed(event);
}

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

public void sessionCreated(HttpSessionEvent event) {
    synchronized (this) {
        sessionCount++;/*from w ww  .  ja v a  2  s.c o m*/
        log.info("Session Created: " + event.getSession().getId() + " at " + new Date());
        log.info("Current number of sessions: " + sessionCount);
    }
}

From source file:cc.kune.core.server.UserSessionMonitor.java

@Override
public void sessionCreated(final HttpSessionEvent event) {
    LOG.debug(String.format("Session created (with max inactive: %d)",
            event.getSession().getMaxInactiveInterval())); // , new Throwable());
    // event.getSession().getServletContext().getContextPath(),
}

From source file:org.alfresco.repo.webdav.WebDAVSessionListener.java

@Override
public void sessionCreated(HttpSessionEvent hse) {
    if (logger.isDebugEnabled()) {
        logger.debug("Session created " + hse.getSession().getId());
    }/*from www.  jav  a  2 s .  co m*/
}