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:tds.tdsadmin.session.TdsAdminSessionListener.java

public void sessionCreated(HttpSessionEvent event) {
    PropertiesBean props = WebApplicationContextUtils
            .getWebApplicationContext(event.getSession().getServletContext()).getBean(PropertiesBean.class);
    int tdsadminTimeout = props.getTdsadminTimeout();
    event.getSession().setMaxInactiveInterval(tdsadminTimeout * 60);
    _logger.info(String.format("TDS Admin session timeout set as %s minutes.", tdsadminTimeout));
}

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

@SuppressWarnings("unchecked")
@Override//from ww  w  .  j  av a  2  s  . c o  m
public void sessionDestroyed(HttpSessionEvent hse) {
    webDAVLockService.setCurrentSession(hse.getSession());
    webDAVLockService.sessionDestroyed();

    if (logger.isDebugEnabled()) {
        logger.debug("Session destroyed " + hse.getSession().getId());
    }
}

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

public void sessionCreated(HttpSessionEvent se) {
    if (log.isDebugEnabled()) {
        log.debug("New CDE Browser session " + se.getSession().getId() + " is created");
    }/*from ww w  .  j  av  a 2  s.  c  om*/
    CDEBrowserParams.reloadInstance();
    return;
}

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

/**
 * set time out/*from  ww w.j  a v  a  2 s.c  o m*/
 */
public void sessionCreated(HttpSessionEvent se) {
    HttpSession session = null;
    try {
        session = se.getSession();
        // get value
        ServletContext context = session.getServletContext();
        String timeoutValue = context.getInitParameter("sessionTimeout");
        int timeout = Integer.valueOf(timeoutValue);
        // set value
        session.setMaxInactiveInterval(timeout);
        logger.info("session max inactive interval has been set to " + timeout + " seconds.");
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

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

/**
 * @see org.zkoss.zk.ui.http.HttpSessionListener23#sessionCreated(javax.servlet.http.HttpSessionEvent)
 *///from   www. j  av  a2s  .  c  o  m
@Override
public void sessionCreated(final HttpSessionEvent event) {
    log.info(String.format("Native HttpSession Creation Event : %s : %s", event.getSession().getId(), event));
    super.sessionCreated(event);
}

From source file:SessionLogger.java

public void sessionDestroyed(HttpSessionEvent se) {

    //log request about session's that are invalidated
    log.info("HttpSession invalidated: " + se.getSession().getId());

}

From source file:org.seratic.enterprise.tgestiona.web.filter.AppHttpSessionListener.java

@Override
public void sessionDestroyed(HttpSessionEvent se) {
    Log log = LogFactory.getLog("Aplicacion");
    HttpSession session = se.getSession();
    long now = new java.util.Date().getTime();
    boolean timeout = (now - session.getLastAccessedTime()) >= ((long) session.getMaxInactiveInterval()
            * 1000L);//  ww w . j ava  2  s .  c  o  m
    if (timeout) {
        long duration = new Date().getTime() - session.getCreationTime();
        long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(duration);
        long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(duration);
        long diffInHours = TimeUnit.MILLISECONDS.toHours(duration);
        SimpleDateFormat formatFechaHora = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
        log.info("Sesiones-> Finalizacion automatica de sesion");
        log.info("Sesiones-> Id Sesion: " + session.getId());
        log.info("Sesiones-> Fecha creacion sesion: "
                + formatFechaHora.format(new Date(session.getCreationTime())));
        log.info("Sesiones-> Tiempo conexion sesion, " + diffInHours + " Horas " + diffInMinutes + " Minutos "
                + diffInSeconds + " Segundos.");
        log.info("Sesiones-> Fecha ultima peticion: "
                + formatFechaHora.format(new Date(session.getLastAccessedTime())));
        log.info("Sesiones-> Fecha sesion timeout: " + formatFechaHora
                .format(new Date(session.getLastAccessedTime() + session.getMaxInactiveInterval() * 1000)));
    }
}

From source file:com.liferay.portal.servlet.PortalSessionListener.java

public void sessionCreated(HttpSessionEvent event) {
    HttpSession ses = event.getSession();

    PortalSessionContext.put(ses.getId(), ses);

    // Process session created events

    try {/*from  w  w w.  j  a v  a  2  s  .co  m*/
        EventsProcessor.process(PropsUtil.getArray(PropsUtil.SERVLET_SESSION_CREATE_EVENTS), ses);
    } catch (ActionException ae) {
        Logger.error(this, ae.getMessage(), ae);
    }
}

From source file:org.acegisecurity.ui.session.HttpSessionEventPublisher.java

/**
 * Handles the HttpSessionEvent by publishing a {@link HttpSessionCreatedEvent} to the application
 * appContext./*  w  ww.  ja  v a  2s .c  o  m*/
 *
 * @param event HttpSessionEvent passed in by the container
 */
public void sessionCreated(HttpSessionEvent event) {
    HttpSessionCreatedEvent e = new HttpSessionCreatedEvent(event.getSession());

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

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

From source file:org.etudes.jforum.ForumSessionListener.java

/** 
 * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
 */// w  ww.  jav a2s . com
public void sessionDestroyed(HttpSessionEvent event) {
    HttpSession session = event.getSession();

    if (session == null) {
        return;
    }

    String sessionId = session.getId();

    try {
        SessionFacade.storeSessionData(sessionId);
    } catch (Exception e) {
        logger.warn(e);
    }

    UserSession us = SessionFacade.getUserSession(sessionId);

    /*if (us != null) {
       SecurityRepository.remove(us.getUserId());
    }*/

    SessionFacade.remove(sessionId);
}