costin 2003/03/25 15:35:35 Modified: catalina/src/share/org/apache/catalina/servlets StatusManagerServlet.java Log: Roll back to the previous version. Revision Changes Path 1.5 +75 -64 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/StatusManagerServlet.java Index: StatusManagerServlet.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/servlets/StatusManagerServlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StatusManagerServlet.java 24 Mar 2003 12:46:39 -0000 1.4 +++ StatusManagerServlet.java 25 Mar 2003 23:35:34 -0000 1.5 @@ -234,14 +234,10 @@ HttpServletResponse response) throws IOException, ServletException { - response.setContentType("text/xml"); + response.setContentType("text/html"); PrintWriter writer = response.getWriter(); - writer.write("<?xml version=\"1.0\"?>"); - writer.write - ("<?xml-stylesheet type=\"text/xsl\" href=\"xform.xsl\" ?>"); - writer.write("<status>"); try { // Display virtual machine statistics @@ -257,7 +253,6 @@ } catch (Exception e) { e.printStackTrace(); } - writer.write("</status>"); } @@ -268,14 +263,17 @@ protected void writeVMState(PrintWriter writer) throws Exception { - writer.write("<jvm>"); + writer.print("<h1>JVM</h1>"); + writer.print("<br/>"); - writer.write("<memory"); - writer.write(" free='" + Runtime.getRuntime().freeMemory() + "'"); - writer.write(" total='" + Runtime.getRuntime().totalMemory() + "'"); - writer.write(" max='" + Runtime.getRuntime().maxMemory() + "'/>"); + writer.print(" Free memory: "); + writer.print(Runtime.getRuntime().freeMemory()); + writer.print(" Total memory: "); + writer.print(Runtime.getRuntime().totalMemory()); + writer.print(" Max memory: "); + writer.print(Runtime.getRuntime().maxMemory()); - writer.write("</jvm>"); + writer.print("<br/>"); } @@ -287,15 +285,24 @@ ObjectName tpName, String name) throws Exception { - writer.write("<connector name='" + name + "'>"); + writer.print("<h1>"); + writer.print(name); + writer.print("</h1>"); + + writer.print("<br/>"); + + writer.print(" Max threads: "); + writer.print(mBeanServer.getAttribute(tpName, "maxThreads")); + writer.print(" Min spare threads: "); + writer.print(mBeanServer.getAttribute(tpName, "minSpareThreads")); + writer.print(" Max spare threads: "); + writer.print(mBeanServer.getAttribute(tpName, "maxSpareThreads")); + writer.print(" Current thread count: "); + writer.print(mBeanServer.getAttribute(tpName, "currentThreadCount")); + writer.print(" Current thread busy: "); + writer.print(mBeanServer.getAttribute(tpName, "currentThreadsBusy")); - writer.write("<threadInfo "); - writer.write(" maxThreads=\"" + mBeanServer.getAttribute(tpName, "maxThreads") + "\""); - writer.write(" minSpareThreads=\"" + mBeanServer.getAttribute(tpName, "minSpareThreads") + "\""); - writer.write(" maxSpareThreads=\"" + mBeanServer.getAttribute(tpName, "maxSpareThreads") + "\""); - writer.write(" currentThreadCount=\"" + mBeanServer.getAttribute(tpName, "currentThreadCount") + "\""); - writer.write(" currentThreadsBusy=\"" + mBeanServer.getAttribute(tpName, "currentThreadsBusy") + "\""); - writer.write(" />"); + writer.print("<br/>"); ObjectName grpName = null; @@ -307,32 +314,38 @@ } } - if (grpName != null) { + if (grpName == null) { + return; + } - writer.write("<requestInfo "); - writer.write(" maxTime=\"" + mBeanServer.getAttribute(grpName, "maxTime") + "\""); - writer.write(" processingTime=\"" + mBeanServer.getAttribute(grpName, "processingTime") + "\""); - writer.write(" requestCount=\"" + mBeanServer.getAttribute(grpName, "requestCount") + "\""); - writer.write(" errorCount=\"" + mBeanServer.getAttribute(grpName, "errorCount") + "\""); - writer.write(" bytesReceived=\"" + mBeanServer.getAttribute(grpName, "bytesReceived") + "\""); - writer.write(" bytesSent=\"" + mBeanServer.getAttribute(grpName, "bytesSent") + "\""); - writer.write(" />"); + writer.print(" Max processing time: "); + writer.print(mBeanServer.getAttribute(grpName, "maxTime")); + writer.print(" Processing time:"); + writer.print(mBeanServer.getAttribute(grpName, "processingTime")); + writer.print(" Request count: "); + writer.print(mBeanServer.getAttribute(grpName, "requestCount")); + writer.print(" Error count: "); + writer.print(mBeanServer.getAttribute(grpName, "errorCount")); + writer.print(" Bytes received: "); + writer.print(mBeanServer.getAttribute(grpName, "bytesReceived")); + writer.print(" Bytes sent: "); + writer.print(mBeanServer.getAttribute(grpName, "bytesSent")); + writer.print("<br/>"); - writer.write("<workers>"); - enum = requestProcessors.elements(); - while (enum.hasMoreElements()) { - ObjectName objectName = (ObjectName) enum.nextElement(); - if (name.equals(objectName.getKeyProperty("worker"))) { - writer.write("<worker>"); - writeProcessorState(writer, objectName); - writer.write("</worker>"); - } + writer.print("<table border=\"0\"><tr><th>Stage</th><th>Time</th><th>B Sent</th><th>B Recv</th><th>Client</th><th>VHost</th><th>Request</th></tr>"); + + enum = requestProcessors.elements(); + while (enum.hasMoreElements()) { + ObjectName objectName = (ObjectName) enum.nextElement(); + if (name.equals(objectName.getKeyProperty("worker"))) { + writer.print("<tr>"); + writeProcessorState(writer, objectName); + writer.print("</tr>"); } - writer.write("</workers>"); } - writer.write("</connector>"); + writer.print("</table>"); } @@ -343,13 +356,13 @@ protected void writeProcessorState(PrintWriter writer, ObjectName pName) throws Exception { - Integer stageValue = + Integer stageValue = (Integer) mBeanServer.getAttribute(pName, "stage"); int stage = stageValue.intValue(); boolean fullStatus = true; + writer.write("<td><b>"); - writer.write("<stage>"); switch (stage) { case (1/*org.apache.coyote.Constants.STAGE_PARSE*/): @@ -387,44 +400,42 @@ } - writer.write("</stage>"); + writer.write("</b></td>"); if (fullStatus) { - writer.write("<requestProcessingTime>"); - writer.write("" + mBeanServer.getAttribute + writer.write("<td>"); + writer.print(mBeanServer.getAttribute (pName, "requestProcessingTime")); - writer.write("</requestProcessingTime>"); - writer.write("<requestBytesSent>"); - writer.write("" + mBeanServer.getAttribute + writer.write("</td>"); + writer.write("<td>"); + writer.print(mBeanServer.getAttribute (pName, "requestBytesSent")); - writer.write("</requestBytesSent>"); - writer.write("<requestBytesReceived>"); - writer.write("" + mBeanServer.getAttribute + writer.write("</td>"); + writer.write("<td>"); + writer.print(mBeanServer.getAttribute (pName, "requestBytesReceived")); - writer.write("</requestBytesReceived>"); - writer.write("<remoteAddr>"); - writer.write("" + mBeanServer.getAttribute(pName, "remoteAddr")); - writer.write("</remoteAddr>"); - writer.write("<virtualHost>"); + writer.write("</td>"); + writer.write("<td>"); + writer.print("" + mBeanServer.getAttribute(pName, "remoteAddr")); + writer.write("</td>"); + writer.write("<td nowrap>"); writer.write("" + filter(mBeanServer.getAttribute (pName, "virtualHost").toString())); - writer.write("</virtualHost>"); - writer.write("<method>"); + writer.write("</td>"); + writer.write("<td nowrap>"); writer.write("" + filter(mBeanServer.getAttribute (pName, "method").toString())); - writer.write("</method>"); - writer.write("<currentUri>"); writer.write("" + filter(mBeanServer.getAttribute (pName, "currentUri").toString())); - writer.write("</currentUri>"); - writer.write("<currentQueryString>"); String queryString = (String) mBeanServer.getAttribute (pName, "currentQueryString"); if ((queryString != null) && (!queryString.equals(""))) { writer.write("?"); - writer.write(queryString); + writer.print(queryString); } - writer.write("</currentQueryString>"); + writer.write("</td>"); + } else { + writer.write("<td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td>"); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]