1 /**
2 *
3 * Copyright 2003-2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18
19
20
21
22
23
24 package javax.servlet;
25
26 /**
27 * This is the event class for notifications about changes to the attributes of the
28 * servlet context of a web application.
29 * @see ServletContextAttributeListener
30 * @since Servlet 2.3
31 *
32 * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
33 */
34 public class ServletContextAttributeEvent extends ServletContextEvent {
35 private String name;
36 private Object value;
37
38 /**
39 * Construct a ServletContextAttributeEvent from the given context for the
40 * given attribute name and attribute value.
41 */
42 public ServletContextAttributeEvent(ServletContext source, String name, Object value) {
43 super(source);
44 this.name = name;
45 this.value = value;
46 }
47
48 /**
49 * Return the name of the attribute that changed on the ServletContext.
50 */
51 public String getName() {
52 return this.name;
53 }
54
55 /**
56 * Returns the value of the attribute that has been added, removed, or replaced.
57 * If the attribute was added, this is the value of the attribute. If the attrubute was
58 * removed, this is the value of the removed attribute. If the attribute was replaced, this
59 * is the old value of the attribute.
60 */
61 public Object getValue() {
62 return this.value;
63 }
64 }
65