Class ContextManagerListener

  • All Implemented Interfaces:
    EventListener, javax.servlet.http.HttpSessionListener, javax.servlet.ServletRequestListener

    public class ContextManagerListener
    extends AbstractHttpSessionListener
    implements javax.servlet.ServletRequestListener
    This listener is used to manage the components of scope SessionScoped and RequestScoped
    Version:
    $Id$
    Author:
    Nicolas Filotto
    • Constructor Detail

      • ContextManagerListener

        public ContextManagerListener()
    • Method Detail

      • requestDestroyed

        public void requestDestroyed​(javax.servlet.ServletRequestEvent event)
        Specified by:
        requestDestroyed in interface javax.servlet.ServletRequestListener
      • requestInitialized

        public void requestInitialized​(javax.servlet.ServletRequestEvent event)
        Specified by:
        requestInitialized in interface javax.servlet.ServletRequestListener
      • requirePortalEnvironment

        protected boolean requirePortalEnvironment()
        Indicates if it requires that a full portal environment must be set
        Specified by:
        requirePortalEnvironment in class AbstractHttpSessionListener
        Returns:
        true if it requires the portal environment false otherwise.
      • onRequestInitialized

        protected void onRequestInitialized​(ExoContainer container,
                                            javax.servlet.ServletRequestEvent event)
        Called when a request is created
      • onRequestDestroyed

        protected void onRequestDestroyed​(ExoContainer container,
                                          javax.servlet.ServletRequestEvent event)
        Called when a request is destroyed
      • onSessionCreated

        protected void onSessionCreated​(ExoContainer container,
                                        javax.servlet.http.HttpSessionEvent event)
        Allow sub-classes to execute an action when a session is created
        Specified by:
        onSessionCreated in class AbstractHttpSessionListener
        Parameters:
        container - the eXo container
        event - the HttpSessionEvent
      • onSessionDestroyed

        protected void onSessionDestroyed​(ExoContainer container,
                                          javax.servlet.http.HttpSessionEvent event)
        Allow sub-classes to execute an action when a session is destroyed
        Specified by:
        onSessionDestroyed in class AbstractHttpSessionListener
        Parameters:
        container - the eXo container
        event - the HttpSessionEvent
      • getContainer

        protected final ExoContainer getContainer​(javax.servlet.ServletRequestEvent event)
        Returns:
        Gives the ExoContainer that fits best with the current context
      • registerIfNeeded

        public static void registerIfNeeded​(ExoContainer container,
                                            javax.servlet.ServletContext context)
        Registers dynamically the listener if a ContextManager has been defined and a context for SessionScoped and/or RequestScoped has been configured.
        Parameters:
        container - the container from which we will get the ContextManager
        context - the context to which we want to add the listener