1 16 17 18 package org.apache.webapp.admin; 19 20 21 import java.io.IOException ; 22 import java.io.PrintWriter ; 23 import java.util.ArrayList ; 24 import java.util.Collections ; 25 import java.util.Iterator ; 26 import javax.management.MBeanServer ; 27 import javax.management.ObjectName ; 28 import javax.servlet.ServletException ; 29 import javax.servlet.http.HttpServletRequest ; 30 import javax.servlet.http.HttpServletResponse ; 31 import javax.servlet.http.HttpSession ; 32 import org.apache.struts.action.Action; 33 import org.apache.struts.action.ActionErrors; 34 import org.apache.struts.action.ActionForm; 35 import org.apache.struts.action.ActionForward; 36 import org.apache.struts.action.ActionMapping; 37 38 39 46 47 public final class DumpServerAction extends Action { 48 49 50 52 53 68 public ActionForward execute(ActionMapping mapping, 69 ActionForm form, 70 HttpServletRequest request, 71 HttpServletResponse response) 72 throws IOException , ServletException { 73 74 MBeanServer server = ((ApplicationServlet) getServlet()).getServer(); 76 Iterator names = server.queryNames(null, null).iterator(); 77 ArrayList list = new ArrayList (); 78 while (names.hasNext()) { 79 list.add(names.next().toString()); 80 } 81 Collections.sort(list); 82 request.setAttribute("names", list); 83 84 return (mapping.findForward("Dump Server Results")); 86 87 } 88 89 90 } 91 | Popular Tags |