2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package javax.servlet.http;
21 * Events of this type are either sent to an object that implements
22 * {@link HttpSessionBindingListener} when it is bound or unbound from a
23 * session, or to a {@link HttpSessionAttributeListener} that has been
24 * configured in the deployment descriptor when any attribute is bound, unbound
25 * or replaced in a session.
27 * The session binds the object by a call to
28 * <code>HttpSession.setAttribute</code> and unbinds the object by a call to
29 * <code>HttpSession.removeAttribute</code>.
32 * @see HttpSessionBindingListener
33 * @see HttpSessionAttributeListener
35 public class HttpSessionBindingEvent extends HttpSessionEvent {
37 private static final long serialVersionUID = 1L;
39 /* The name to which the object is being bound or unbound */
40 private final String name;
42 /* The object is being bound or unbound */
43 private final Object value;
46 * Constructs an event that notifies an object that it has been bound to or
47 * unbound from a session. To receive the event, the object must implement
48 * {@link HttpSessionBindingListener}.
51 * the session to which the object is bound or unbound
53 * the name with which the object is bound or unbound
57 public HttpSessionBindingEvent(HttpSession session, String name) {
64 * Constructs an event that notifies an object that it has been bound to or
65 * unbound from a session. To receive the event, the object must implement
66 * {@link HttpSessionBindingListener}.
69 * the session to which the object is bound or unbound
71 * the name with which the object is bound or unbound
75 public HttpSessionBindingEvent(HttpSession session, String name,
82 /** Return the session that changed. */
84 public HttpSession getSession() {
85 return super.getSession();
89 * Returns the name with which the attribute is bound to or unbound from the
92 * @return a string specifying the name with which the object is bound to or
93 * unbound from the session
95 public String getName() {
100 * Returns the value of the attribute that has been added, removed or
101 * replaced. If the attribute was added (or bound), this is the value of the
102 * attribute. If the attribute was removed (or unbound), this is the value
103 * of the removed attribute. If the attribute was replaced, this is the old
104 * value of the attribute.
108 public Object getValue() {