1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.jetty.server.handler.jmx;
20
21 import java.util.Enumeration;
22 import java.util.HashMap;
23 import java.util.Map;
24
25 import org.eclipse.jetty.server.handler.ContextHandler;
26 import org.eclipse.jetty.util.Attributes;
27
28 public class ContextHandlerMBean extends AbstractHandlerMBean
29 {
30 public ContextHandlerMBean(Object managedObject)
31 {
32 super(managedObject);
33 }
34
35 public Map getContextAttributes()
36 {
37 Map map = new HashMap();
38 Attributes attrs = ((ContextHandler)_managed).getAttributes();
39 Enumeration en = attrs.getAttributeNames();
40 while (en.hasMoreElements())
41 {
42 String name = (String)en.nextElement();
43 Object value = attrs.getAttribute(name);
44 map.put(name,value);
45 }
46 return map;
47 }
48
49 public void setContextAttribute(String name, Object value)
50 {
51 Attributes attrs = ((ContextHandler)_managed).getAttributes();
52 attrs.setAttribute(name,value);
53 }
54
55 public void setContextAttribute(String name, String value)
56 {
57 Attributes attrs = ((ContextHandler)_managed).getAttributes();
58 attrs.setAttribute(name,value);
59 }
60
61 public void removeContextAttribute(String name)
62 {
63 Attributes attrs = ((ContextHandler)_managed).getAttributes();
64 attrs.removeAttribute(name);
65 }
66 }