Save This Page
Home » glassfish-v2ur2-b04-src » javax » servlet » http » [javadoc | source]
    1   
    2   
    3   /*
    4    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    5    * 
    6    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    7    * 
    8    * Portions Copyright Apache Software Foundation.
    9    * 
   10    * The contents of this file are subject to the terms of either the GNU
   11    * General Public License Version 2 only ("GPL") or the Common Development
   12    * and Distribution License("CDDL") (collectively, the "License").  You
   13    * may not use this file except in compliance with the License. You can obtain
   14    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   15    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   16    * language governing permissions and limitations under the License.
   17    * 
   18    * When distributing the software, include this License Header Notice in each
   19    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   20    * Sun designates this particular file as subject to the "Classpath" exception
   21    * as provided by Sun in the GPL Version 2 section of the License file that
   22    * accompanied this code.  If applicable, add the following below the License
   23    * Header, with the fields enclosed by brackets [] replaced by your own
   24    * identifying information: "Portions Copyrighted [year]
   25    * [name of copyright owner]"
   26    * 
   27    * Contributor(s):
   28    * 
   29    * If you wish your version of this file to be governed by only the CDDL or
   30    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   31    * elects to include this software in this distribution under the [CDDL or GPL
   32    * Version 2] license."  If you don't indicate a single choice of license, a
   33    * recipient has the option to distribute your version of this file under
   34    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   35    * its licensees as provided above.  However, if you add GPL Version 2 code
   36    * and therefore, elected the GPL Version 2 license, then the option applies
   37    * only if the new code is made subject to such option by the copyright
   38    * holder.
   39    */
   40   
   41   
   42   package javax.servlet.http;
   43   
   44   
   45   
   46   /**
   47    *
   48    * Events of this type are either sent to an object that implements
   49    * {@link HttpSessionBindingListener} when it is bound or 
   50    * unbound from a session, or to a {@link HttpSessionAttributeListener} 
   51    * that has been configured in the deployment descriptor when any attribute is
   52    * bound, unbound or replaced in a session.
   53    *
   54    * <p>The session binds the object by a call to
   55    * <code>HttpSession.setAttribute</code> and unbinds the object
   56    * by a call to <code>HttpSession.removeAttribute</code>.
   57    *
   58    *
   59    *
   60    * @author		Various
   61    * 
   62    * @see 		HttpSession
   63    * @see 		HttpSessionBindingListener
   64    * @see			HttpSessionAttributeListener
   65    */
   66   
   67   public class HttpSessionBindingEvent extends HttpSessionEvent {
   68   
   69   
   70   
   71   
   72       /* The name to which the object is being bound or unbound */
   73   
   74       private String name;
   75       
   76       /* The object is being bound or unbound */
   77   
   78       private Object value;
   79       
   80     
   81   
   82       /**
   83        *
   84        * Constructs an event that notifies an object that it
   85        * has been bound to or unbound from a session. 
   86        * To receive the event, the object must implement
   87        * {@link HttpSessionBindingListener}.
   88        *
   89        *
   90        *
   91        * @param session 	the session to which the object is bound or unbound
   92        *
   93        * @param name 	the name with which the object is bound or unbound
   94        *
   95        * @see			#getName
   96        * @see			#getSession
   97        *
   98        */
   99   
  100       public HttpSessionBindingEvent(HttpSession session, String name) {
  101   	super(session);
  102   	this.name = name;
  103       }
  104       
  105       /**
  106        *
  107        * Constructs an event that notifies an object that it
  108        * has been bound to or unbound from a session. 
  109        * To receive the event, the object must implement
  110        * {@link HttpSessionBindingListener}.
  111        *
  112        *
  113        *
  114        * @param session 	the session to which the object is bound or unbound
  115        *
  116        * @param name 	the name with which the object is bound or unbound
  117        *
  118        * @see			#getName
  119        * @see			#getSession
  120        *
  121        */
  122       
  123       public HttpSessionBindingEvent(HttpSession session, String name, Object value) {
  124   	super(session);
  125   	this.name = name;
  126   	this.value = value;
  127       }
  128       
  129       
  130      	/** Return the session that changed. */
  131       public HttpSession getSession () { 
  132   	return super.getSession();
  133       }
  134    
  135      
  136     
  137       
  138       /**
  139        *
  140        * Returns the name with which the attribute is bound to or
  141        * unbound from the session.
  142        *
  143        *
  144        * @return		a string specifying the name with which
  145        *			the object is bound to or unbound from
  146        *			the session
  147        *
  148        *
  149        */
  150   
  151       public String getName() {
  152   	return name;
  153       }
  154       
  155       /**
  156   	* Returns the value of the attribute that has been added, removed or replaced.
  157   	* If the attribute was added (or bound), this is the value of the attribute. If the attribute was
  158   	* removed (or unbound), this is the value of the removed attribute. If the attribute was replaced, this
  159   	* is the old value of the attribute.
  160   	*
  161           * @since 2.3
  162   	*/
  163   	
  164   	public Object getValue() {
  165   	    return this.value;   
  166   	}
  167       
  168   }
  169   
  170   
  171   
  172   
  173   
  174   
  175   

Save This Page
Home » glassfish-v2ur2-b04-src » javax » servlet » http » [javadoc | source]