Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-2324

Document how to use HttpSessionCreatedEvent and HttpSessionDestroyedEvent

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 2.26.02
    • None
    • None

    Description

      1) Create a component that implements ComponentManagerAware, for example

      public class SessionApplicationListener implements ComponentManagerAware {

      private ComponentManager componentManager;

      @Override
      public void setComponentManager(ComponentManager componentManager)

      { this.componentManager = componentManager; }

      public void init()

      { componentManager.registerEventSubscriber(this); }

      public void destroy()

      { HttpSessionRegistry registry = getInstance(); registry.sessions.clear(); componentManager.unregisterEventSubscriber(this); }

      @Subscribe
      public void onHttpSessionCreatedEvent(HttpSessionCreatedEvent event)

      { HttpSessionRegistry registry = getInstance(); registry.sessionCreated(event.getSession()); }

      @Subscribe
      public void onHttpSessionDestroyedEvent(HttpSessionDestroyedEvent event)

      { HttpSessionRegistry registry = getInstance(); registry.sessionDestroyed(event.getSession()); }

      }

      2) add spring configuration with init and destroy methods, for example

      <bean id="com.onehippo.cms7.targeting.store.session.CreateListener"
      class="com.onehippo.cms7.......SessionApplicationListener"
      init-method="init" destroy-method="destroy"/>

      3)

      Attachments

        Issue Links

          Activity

            People

              svoortman Simon Voortman (Inactive)
              aschrijvers Ard Schrijvers
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: