org.apache.turbine.services.session

## Class SessionListener

- java.lang.Object
- - org.apache.turbine.services.session.SessionListener

- All Implemented Interfaces:
    Serializable, EventListener, HttpSessionActivationListener, HttpSessionListener

      public class SessionListener
      extends Object
      implements HttpSessionListener, HttpSessionActivationListener, Serializable

  This class is a listener for both session creation and destruction, and for session activation and passivation. It must be configured via your web application's `web.xml` deployment descriptor as follows for the container to call it:

  > `

  >      <listener>
  >        <listener-class>
  >          org.apache.turbine.session.SessionListener
  >        </listener-class>
  >      </listener>

  > `

  `<listener>` elemements can occur between `<context-param>` and `<servlet>` elements in your deployment descriptor. The `sessionCreated(HttpSessionEvent)` callback will automatically add an instance of this listener to any newly created `HttpSession` for detection of session passivation and re-activation.
  Since:
    2.3
  Version:
    $Id: SessionListener.java 1066925 2011-02-03 19:44:37Z ludwig $
  Author:
    Quinton McCombs, Daniel Rall
  See Also:
    `HttpSessionListener`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionListener()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `sessionCreated(HttpSessionEvent event)` Called by the servlet container when a new session is created
    `void` | `sessionDestroyed(HttpSessionEvent event)` Called by the servlet container when a session is destroyed
    `void` | `sessionDidActivate(HttpSessionEvent event)` Called by the servlet container when an existing session is (re-)activated.
    `void` | `sessionWillPassivate(HttpSessionEvent event)` Called by the servlet container when a an existing session is passivated.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SessionListener

          public SessionListener()

  - ### Method Detail

    - #### sessionCreated

          public void sessionCreated(HttpSessionEvent event)

      Called by the servlet container when a new session is created
      Specified by:
        `sessionCreated` in interface `HttpSessionListener`
      Parameters:
        `event` - Session creation event.

    - #### sessionDestroyed

          public void sessionDestroyed(HttpSessionEvent event)

      Called by the servlet container when a session is destroyed
      Specified by:
        `sessionDestroyed` in interface `HttpSessionListener`
      Parameters:
        `event` - Session destruction event.

    - #### sessionDidActivate

          public void sessionDidActivate(HttpSessionEvent event)

      Called by the servlet container when an existing session is (re-)activated.
      Specified by:
        `sessionDidActivate` in interface `HttpSessionActivationListener`
      Parameters:
        `event` - Session activation event.

    - #### sessionWillPassivate

          public void sessionWillPassivate(HttpSessionEvent event)

      Called by the servlet container when a an existing session is passivated.
      Specified by:
        `sessionWillPassivate` in interface `HttpSessionActivationListener`
      Parameters:
        `event` - Session passivation event.

Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.