1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package javax.servlet;
17
18
19 /**
20 * This is the event class for notifications of changes to the
21 * attributes of the servlet request in an application.
22 * @see ServletRequestAttributeListener
23 * @since Servlet 2.4
24 */
25
26 public class ServletRequestAttributeEvent extends ServletRequestEvent {
27 private String name;
28 private Object value;
29
30 /** Construct a ServletRequestAttributeEvent giving the servlet context
31 * of this web application, the ServletRequest whose attributes are
32 * changing and the name and value of the attribute.
33 *
34 * @param sc the ServletContext that is sending the event.
35 * @param request the ServletRequest that is sending the event.
36 * @param name the name of the request attribute.
37 * @param value the value of the request attribute.
38 */
39 public ServletRequestAttributeEvent(ServletContext sc, ServletRequest request, String name, Object value) {
40 super(sc, request);
41 this.name = name;
42 this.value = value;
43 }
44
45 /**
46 * Return the name of the attribute that changed on the ServletRequest.
47 *
48 * @return the name of the changed request attribute
49 */
50 public String getName() {
51 return this.name;
52 }
53
54 /**
55 * Returns the value of the attribute that has been added, removed or
56 * replaced. If the attribute was added, this is the value of the
57 * attribute. If the attribute was removed, this is the value of the
58 * removed attribute. If the attribute was replaced, this is the old
59 * value of the attribute.
60 *
61 * @return the value of the changed request attribute
62 */
63 public Object getValue() {
64 return this.value;
65 }
66 }