Search in sources :

Example 1 with ImmutableHttpSessionAdapter

use of org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter in project wildfly by wildfly.

the class InfinispanSessionManager method triggerPrePassivationEvents.

void triggerPrePassivationEvents(ImmutableSession session) {
    List<HttpSessionActivationListener> listeners = findListeners(session);
    if (!listeners.isEmpty()) {
        HttpSessionEvent event = new HttpSessionEvent(new ImmutableHttpSessionAdapter(session, this.context));
        listeners.forEach(listener -> listener.sessionWillPassivate(event));
    }
}
Also used : HttpSessionEvent(javax.servlet.http.HttpSessionEvent) HttpSessionActivationListener(javax.servlet.http.HttpSessionActivationListener) ImmutableHttpSessionAdapter(org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter)

Example 2 with ImmutableHttpSessionAdapter

use of org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter in project wildfly by wildfly.

the class InfinispanSessionManager method triggerPostActivationEvents.

void triggerPostActivationEvents(ImmutableSession session) {
    List<HttpSessionActivationListener> listeners = findListeners(session);
    if (!listeners.isEmpty()) {
        HttpSessionEvent event = new HttpSessionEvent(new ImmutableHttpSessionAdapter(session, this.context));
        listeners.forEach(listener -> listener.sessionDidActivate(event));
    }
}
Also used : HttpSessionEvent(javax.servlet.http.HttpSessionEvent) HttpSessionActivationListener(javax.servlet.http.HttpSessionActivationListener) ImmutableHttpSessionAdapter(org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter)

Example 3 with ImmutableHttpSessionAdapter

use of org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter in project wildfly by wildfly.

the class InfinispanSessionManager method removed.

@CacheEntryRemoved
public void removed(CacheEntryRemovedEvent<SessionCreationMetaDataKey, ?> event) {
    if (event.isPre()) {
        String id = event.getKey().getValue();
        InfinispanWebLogger.ROOT_LOGGER.tracef("Session %s will be removed", id);
        Map.Entry<MV, AV> value = this.factory.findValue(id);
        if (value != null) {
            ImmutableSession session = this.factory.createImmutableSession(id, value);
            ImmutableSessionAttributes attributes = session.getAttributes();
            HttpSession httpSession = new ImmutableHttpSessionAdapter(session, this.context);
            for (String name : attributes.getAttributeNames()) {
                Object attribute = attributes.getAttribute(name);
                if (attribute instanceof HttpSessionBindingListener) {
                    HttpSessionBindingListener listener = (HttpSessionBindingListener) attribute;
                    listener.valueUnbound(new HttpSessionBindingEvent(httpSession, name, attribute));
                }
            }
            if (this.recorder != null) {
                this.recorder.record(session);
            }
        }
    }
}
Also used : HttpSessionBindingEvent(javax.servlet.http.HttpSessionBindingEvent) ImmutableSessionAttributes(org.wildfly.clustering.web.session.ImmutableSessionAttributes) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) HttpSession(javax.servlet.http.HttpSession) HttpSessionBindingListener(javax.servlet.http.HttpSessionBindingListener) Map(java.util.Map) ImmutableHttpSessionAdapter(org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter) CacheEntryRemoved(org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved)

Aggregations

ImmutableHttpSessionAdapter (org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter)3 HttpSessionActivationListener (javax.servlet.http.HttpSessionActivationListener)2 HttpSessionEvent (javax.servlet.http.HttpSessionEvent)2 Map (java.util.Map)1 HttpSession (javax.servlet.http.HttpSession)1 HttpSessionBindingEvent (javax.servlet.http.HttpSessionBindingEvent)1 HttpSessionBindingListener (javax.servlet.http.HttpSessionBindingListener)1 CacheEntryRemoved (org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved)1 ImmutableSession (org.wildfly.clustering.web.session.ImmutableSession)1 ImmutableSessionAttributes (org.wildfly.clustering.web.session.ImmutableSessionAttributes)1