javax.servlet.http.HttpSessionListener

Here are the examples of the java api class javax.servlet.http.HttpSessionListener taken from open source projects.

1. SessionEventHttpSessionListenerAdapter#onApplicationEvent()

Project: lemon
File: SessionEventHttpSessionListenerAdapter.java
/*
	 * (non-Javadoc)
	 *
	 * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.
	 * springframework.context.ApplicationEvent)
	 */
public void onApplicationEvent(AbstractSessionEvent event) {
    if (this.listeners.isEmpty()) {
        return;
    }
    HttpSessionEvent httpSessionEvent = createHttpSessionEvent(event);
    for (HttpSessionListener listener : this.listeners) {
        if (event instanceof SessionDestroyedEvent) {
            listener.sessionDestroyed(httpSessionEvent);
        } else if (event instanceof SessionCreatedEvent) {
            listener.sessionCreated(httpSessionEvent);
        }
    }
}

2. ProxyServletListener#sessionDestroyed()

Project: lemon
File: ProxyServletListener.java
public void sessionDestroyed(HttpSessionEvent se) {
    if (ctx == null) {
        logger.warn("cannot find applicationContext");
        return;
    }
    Collection<HttpSessionListener> httpSessionListeners = ctx.getBeansOfType(HttpSessionListener.class).values();
    for (HttpSessionListener httpSessionListener : httpSessionListeners) {
        httpSessionListener.sessionDestroyed(se);
    }
}

3. ProxyServletListener#sessionCreated()

Project: lemon
File: ProxyServletListener.java
public void sessionCreated(HttpSessionEvent se) {
    if (ctx == null) {
        logger.warn("cannot find applicationContext");
        return;
    }
    Collection<HttpSessionListener> httpSessionListeners = ctx.getBeansOfType(HttpSessionListener.class).values();
    for (HttpSessionListener httpSessionListener : httpSessionListeners) {
        httpSessionListener.sessionCreated(se);
    }
}

4. SessionMonitor#sessionDestroyed()

Project: jodd
File: SessionMonitor.java
/**
	 * Removes session from a map and broadcasts event to registered listeners.
	 */
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
    HttpSession session = httpSessionEvent.getSession();
    sessionMap.remove(session.getId());
    for (HttpSessionListener listener : listeners) {
        listener.sessionDestroyed(httpSessionEvent);
    }
}

5. SessionMonitor#sessionCreated()

Project: jodd
File: SessionMonitor.java
// ---------------------------------------------------------------- broadcast
/**
	 * Stores session in map and broadcasts event to registered listeners.
	 */
public void sessionCreated(HttpSessionEvent httpSessionEvent) {
    HttpSession session = httpSessionEvent.getSession();
    sessionMap.putIfAbsent(session.getId(), session);
    for (HttpSessionListener listener : listeners) {
        listener.sessionCreated(httpSessionEvent);
    }
}