Class WeldTerminalListener

  • All Implemented Interfaces:
    jakarta.servlet.http.HttpSessionListener, EventListener

    public class WeldTerminalListener
    extends Object
    implements jakarta.servlet.http.HttpSessionListener
    This listener activates the HttpSessionDestructionContext in sessionDestroyed(), but only if HttpSessionContext is not active at the time (it is active when sessionDestroyed is invoked as a result of session.invalidate() during an http request, and is not active when sessionDestroyed is invoked when the session times out or when all the sessions are destroyed because the deployment is being removed). This listener should always be the last registered listener. This will ensure this listener can activate the session context before any other listeners try to access it (the listeners are notified in reverse order when a session is being destroyed). Any listeners notified before this one will receive a ContextNotActiveException when trying to access any @SessionScoped bean.
    Author:
    Marko Luksa
    • Constructor Detail

      • WeldTerminalListener

        public WeldTerminalListener()
      • WeldTerminalListener

        public WeldTerminalListener​(BeanManagerImpl beanManager)
    • Method Detail

      • sessionCreated

        public void sessionCreated​(jakarta.servlet.http.HttpSessionEvent httpSessionEvent)
        Specified by:
        sessionCreated in interface jakarta.servlet.http.HttpSessionListener
      • sessionDestroyed

        public void sessionDestroyed​(jakarta.servlet.http.HttpSessionEvent event)
        Specified by:
        sessionDestroyed in interface jakarta.servlet.http.HttpSessionListener