Class ContextManagerListener

java.lang.Object
org.exoplatform.container.web.AbstractHttpSessionListener
org.exoplatform.container.context.ContextManagerListener
All Implemented Interfaces:
jakarta.servlet.http.HttpSessionListener, jakarta.servlet.ServletRequestListener, EventListener

public class ContextManagerListener extends AbstractHttpSessionListener implements jakarta.servlet.ServletRequestListener
This listener is used to manage the components of scope SessionScoped and RequestScoped
  • Constructor Details

    • ContextManagerListener

      public ContextManagerListener()
  • Method Details

    • requestDestroyed

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

      public void requestInitialized(jakarta.servlet.ServletRequestEvent event)
      Specified by:
      requestInitialized in interface jakarta.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, jakarta.servlet.ServletRequestEvent event)
      Called when a request is created
    • onRequestDestroyed

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

      protected void onSessionCreated(ExoContainer container, jakarta.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, jakarta.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(jakarta.servlet.ServletRequestEvent event)
      Returns:
      Gives the ExoContainer that fits best with the current context
    • registerIfNeeded

      public static void registerIfNeeded(ExoContainer container, jakarta.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