Details
-
Task
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
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)
public void init()
{ componentManager.registerEventSubscriber(this); }public void destroy()
{ HttpSessionRegistry registry = getInstance(); registry.sessions.clear(); componentManager.unregisterEventSubscriber(this); } @Subscribe
public void onHttpSessionCreatedEvent(HttpSessionCreatedEvent event)
@Subscribe
public void onHttpSessionDestroyedEvent(HttpSessionDestroyedEvent event)
}
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
- relates to
-
HSTTWO-2235 Allow http session listeners to be injected as a spring bean
- Closed