Coverage report

  %line %branch
org.apache.turbine.services.session.SessionListener
0% 
0% 

 1  
 package org.apache.turbine.services.session;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License")
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.io.Serializable;
 20  
 import javax.servlet.http.HttpSessionActivationListener;
 21  
 import javax.servlet.http.HttpSessionEvent;
 22  
 import javax.servlet.http.HttpSessionListener;
 23  
 
 24  
 /**
 25  
  * This class is a listener for both session creation and destruction,
 26  
  * and for session activation and passivation.  It must be configured
 27  
  * via your web application's <code>web.xml</code> deployment
 28  
  * descriptor as follows for the container to call it:
 29  
  *
 30  
  * <blockquote><code><pre>
 31  
  * &lt;listener&gt;
 32  
  *   &lt;listener-class&gt;
 33  
  *     org.apache.turbine.session.SessionListener
 34  
  *   &lt;/listener-class&gt;
 35  
  * &lt;/listener&gt;
 36  
  * </pre></code></blockquote>
 37  
  *
 38  
  * <code>&lt;listener&gt;</code> elemements can occur between
 39  
  * <code>&lt;context-param&gt;</code> and <code>&lt;servlet&gt;</code>
 40  
  * elements in your deployment descriptor.
 41  
  *
 42  
  * The {@link #sessionCreated(HttpSessionEvent)} callback will
 43  
  * automatically add an instance of this listener to any newly created
 44  
  * <code>HttpSession</code> for detection of session passivation and
 45  
  * re-activation.
 46  
  *
 47  
  * @since 2.3
 48  
  * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
 49  
  * @author <a href="mailto:dlr@apache.org">Daniel Rall</a>
 50  
  * @version $Id: SessionListener.java 278822 2005-09-05 19:53:05Z henning $
 51  
  * @see javax.servlet.http.HttpSessionListener
 52  
  */
 53  0
 public class SessionListener
 54  
         implements HttpSessionListener, HttpSessionActivationListener, Serializable
 55  
 {
 56  
     /** Serial Version UID */
 57  
     private static final long serialVersionUID = -8083730704842809870L;
 58  
 
 59  
     // ---- HttpSessionListener implementation -----------------------------
 60  
 
 61  
     /**
 62  
      * Called by the servlet container when a new session is created
 63  
      *
 64  
      * @param event Session creation event.
 65  
      */
 66  
     public void sessionCreated(HttpSessionEvent event)
 67  
     {
 68  0
         TurbineSession.addSession(event.getSession());
 69  0
         event.getSession().setAttribute(getClass().getName(), this);
 70  0
     }
 71  
 
 72  
     /**
 73  
      * Called by the servlet container when a session is destroyed
 74  
      *
 75  
      * @param event Session destruction event.
 76  
      */
 77  
     public void sessionDestroyed(HttpSessionEvent event)
 78  
     {
 79  0
         TurbineSession.removeSession(event.getSession());
 80  0
     }
 81  
 
 82  
 
 83  
     // ---- HttpSessionActivationListener implementation -------------------
 84  
 
 85  
     /**
 86  
      * Called by the servlet container when an existing session is
 87  
      * (re-)activated.
 88  
      *
 89  
      * @param event Session activation event.
 90  
      */
 91  
     public void sessionDidActivate(HttpSessionEvent event)
 92  
     {
 93  0
         TurbineSession.addSession(event.getSession());
 94  0
     }
 95  
 
 96  
     /**
 97  
      * Called by the servlet container when a an existing session is
 98  
      * passivated.
 99  
      *
 100  
      * @param event Session passivation event.
 101  
      */
 102  
     public void sessionWillPassivate(HttpSessionEvent event)
 103  
     {
 104  0
         TurbineSession.removeSession(event.getSession());
 105  0
     }
 106  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.