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