1 16 package org.mortbay.jetty.servlet.jmx; 17 18 import java.util.ArrayList ; 19 import java.util.Iterator ; 20 import java.util.Map ; 21 22 import javax.management.MBeanException ; 23 24 import org.mortbay.jetty.servlet.ServletHandler; 25 import org.mortbay.jetty.servlet.ServletHolder; 26 27 28 29 34 public class ServletHolderMBean extends HolderMBean 35 { 36 37 private ServletHolder _holder; 38 39 40 43 public ServletHolderMBean() 44 throws MBeanException 45 {} 46 47 48 protected void defineManagedResource() 49 { 50 super.defineManagedResource(); 51 defineAttribute("initOrder"); 52 defineAttribute("paths",READ_ONLY,ON_MBEAN); 53 54 _holder=(ServletHolder)getManagedResource(); 55 } 56 57 58 public String [] getPaths() 59 { 60 ServletHandler handler = (ServletHandler)_holder.getHttpHandler(); 61 Map servletMap = handler.getServletMap(); 62 ArrayList paths = new ArrayList (servletMap.size()); 63 Iterator iter = servletMap.entrySet().iterator(); 64 while (iter.hasNext()) 65 { 66 Map.Entry entry =(Map.Entry )iter.next(); 67 if (entry.getValue()==_holder) 68 paths.add(entry.getKey()); 69 } 70 return (String [])paths.toArray(new String [paths.size()]); 71 } 72 73 74 75 } 76 | Popular Tags |