View Javadoc

1   /*
2   * Copyright 2004 The Apache Software Foundation
3   *
4   * Licensed under the Apache License, Version 2.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *     http://www.apache.org/licenses/LICENSE-2.0
9   *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16  package javax.servlet;
17  
18  
19  	/** 
20  	* This is the event class for notifications about changes to the attributes of the
21  	*  servlet context of a web application.
22  	* @see ServletContextAttributeListener
23  	 * @since	v 2.3
24  	*/
25  
26  public class ServletContextAttributeEvent extends ServletContextEvent { 
27  	private String name;
28  	private Object value;
29  
30  	/** Construct a ServletContextAttributeEvent from the given context for the
31  	** given attribute name and attribute value. 
32  	*/
33  	public ServletContextAttributeEvent(ServletContext source, String name, Object value) {
34  	    super(source);
35  	    this.name = name;
36  	    this.value = value;
37  	}
38  	
39  	/**
40  	* Return the name of the attribute that changed on the ServletContext.
41  	*
42  	*/
43  	public String getName() {
44  		return this.name;
45  	}
46  	
47  	/**
48  	* Returns the value of the attribute that has been added, removed, or replaced.
49  	* If the attribute was added, this is the value of the attribute. If the attribute was
50  	* removed, this is the value of the removed attribute. If the attribute was replaced, this
51  	* is the old value of the attribute.
52  	*
53  	*/
54  	
55  	public Object getValue() {
56  	    return this.value;   
57  	}
58  }
59