org.apache.turbine.services.session

## Class SessionListener

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

- All Implemented Interfaces:
    Serializable, EventListener, javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionListener

      public class SessionListener
      extends Object
      implements javax.servlet.http.HttpSessionListener, javax.servlet.http.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>` elements 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 1773378 2016-12-09 13:19:59Z tv $
  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(javax.servlet.http.HttpSessionEvent event)` Called by the servlet container when a new session is created
    `void` | `sessionDestroyed(javax.servlet.http.HttpSessionEvent event)` Called by the servlet container when a session is destroyed
    `void` | `sessionDidActivate(javax.servlet.http.HttpSessionEvent event)` Called by the servlet container when an existing session is (re-)activated.
    `void` | `sessionWillPassivate(javax.servlet.http.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(javax.servlet.http.HttpSessionEvent event)

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

    - #### sessionDestroyed

          public void sessionDestroyed(javax.servlet.http.HttpSessionEvent event)

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

    - #### sessionDidActivate

          public void sessionDidActivate(javax.servlet.http.HttpSessionEvent event)

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

    - #### sessionWillPassivate

          public void sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)

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

Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.