You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/12/11 01:59:07 UTC
cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager StatusTransformer.java
remm 2003/12/10 16:59:07
Modified: webapps/manager/WEB-INF/classes/org/apache/catalina/manager
StatusTransformer.java
Log:
- Add manager statistics for each context, as well as navigation links so that this
is actually useful. Somehow, the links don't work with Mozilla: it must be
because my HTML is very bad. IE works, though.
Revision Changes Path
1.6 +87 -9 jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusTransformer.java
Index: StatusTransformer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusTransformer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StatusTransformer.java 20 Oct 2003 01:44:54 -0000 1.5
+++ StatusTransformer.java 11 Dec 2003 00:59:07 -0000 1.6
@@ -233,7 +233,7 @@
int mode)
throws Exception {
- if (mode == 0){
+ if (mode == 0) {
writer.print("<h1>");
writer.print(name);
writer.print("</h1>");
@@ -250,7 +250,7 @@
writer.print(" Current thread busy: ");
writer.print(mBeanServer.getAttribute(tpName, "currentThreadsBusy"));
- writer.print("<br/>");
+ writer.print("<br>");
ObjectName grpName = null;
@@ -546,11 +546,39 @@
if (mode == 0){
ObjectName queryHosts = new ObjectName("*:j2eeType=WebModule,*");
Set hostsON = mBeanServer.queryNames(queryHosts, null);
+
+ // Navigation menu
+ writer.print("<h1>");
+ writer.print("Application list");
+ writer.print("</h1>");
+
+ writer.print("<p>");
+ int count = 0;
Iterator iterator = hostsON.iterator();
while (iterator.hasNext()) {
ObjectName contextON = (ObjectName) iterator.next();
+ String webModuleName = contextON.getKeyProperty("name");
+
+ writer.print("<a href=\"#" + (count++) + ".0\">");
+ writer.print(webModuleName);
+ writer.print("</a>");
+ if (iterator.hasNext()) {
+ writer.print("<br>");
+ }
+
+ }
+ writer.print("</p>");
+
+ // Webapp list
+ count = 0;
+ iterator = hostsON.iterator();
+ while (iterator.hasNext()) {
+ ObjectName contextON = (ObjectName) iterator.next();
+ writer.print("<a class=\"A.name\" name=\"#"
+ + (count++) + ".0\">");
writeContext(writer, contextON, mBeanServer, mode);
}
+
} else if (mode == 1){
// for now we don't write out the Detailed state in XML
}
@@ -585,6 +613,17 @@
} else {
return;
}
+
+ ObjectName queryManager = new ObjectName
+ (objectName.getDomain() + ":type=Manager,path=" + contextName
+ + ",host=" + hostName + ",*");
+ Set managersON = mBeanServer.queryNames(queryManager, null);
+ ObjectName managerON = null;
+ Iterator iterator2 = managersON.iterator();
+ while (iterator2.hasNext()) {
+ managerON = (ObjectName) iterator2.next();
+ }
+
// Special case for the root context
if (contextName.equals("/")) {
contextName = "";
@@ -593,6 +632,7 @@
writer.print("<h1>");
writer.print(name);
writer.print("</h1>");
+ writer.print("</a>");
writer.print("<p>");
writer.print(" Startup time: ");
@@ -601,9 +641,13 @@
writer.print(" TLD scan time: ");
writer.print(formatTime(mBeanServer.getAttribute
(objectName, "tldScanTime"), false));
+ if (managerON != null) {
+ writeManager(writer, managerON, mBeanServer, mode);
+ }
writer.print("</p>");
-
- String onStr = "*:j2eeType=Servlet,WebModule=" + webModuleName + ",*";
+
+ String onStr = objectName.getDomain()
+ + ":j2eeType=Servlet,WebModule=" + webModuleName + ",*";
ObjectName servletObjectName = new ObjectName(onStr);
Set set = mBeanServer.queryMBeans(servletObjectName, null);
Iterator iterator = set.iterator();
@@ -611,6 +655,7 @@
ObjectInstance oi = (ObjectInstance) iterator.next();
writeWrapper(writer, oi.getObjectName(), mBeanServer, mode);
}
+
} else if (mode == 1){
// for now we don't write out the context in XML
}
@@ -619,13 +664,46 @@
/**
+ * Write detailed information about a manager.
+ */
+ public static void writeManager(PrintWriter writer, ObjectName objectName,
+ MBeanServer mBeanServer, int mode)
+ throws Exception {
+
+ if (mode == 0) {
+ writer.print("<br>");
+ writer.print(" Active sessions: ");
+ writer.print(mBeanServer.getAttribute
+ (objectName, "activeSessions"));
+ writer.print(" Session count: ");
+ writer.print(mBeanServer.getAttribute
+ (objectName, "sessionCounter"));
+ writer.print(" Max active sessions: ");
+ writer.print(mBeanServer.getAttribute(objectName, "maxActive"));
+ writer.print(" Rejected session creations: ");
+ writer.print(mBeanServer.getAttribute
+ (objectName, "rejectedSessions"));
+ writer.print(" Expired sessions: ");
+ writer.print(mBeanServer.getAttribute
+ (objectName, "expiredSessions"));
+ writer.print(" Processing time: ");
+ writer.print(formatTime(mBeanServer.getAttribute
+ (objectName, "processingTime"), false));
+ } else if (mode == 1) {
+ // for now we don't write out the wrapper details
+ }
+
+ }
+
+
+ /**
* Write detailed information about a wrapper.
*/
public static void writeWrapper(PrintWriter writer, ObjectName objectName,
MBeanServer mBeanServer, int mode)
throws Exception {
- if (mode == 0){
+ if (mode == 0) {
String servletName = objectName.getKeyProperty("name");
String[] mappings = (String[])
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager
StatusTransformer.java
Posted by Remy Maucherat <re...@apache.org>.
Kyle VanderBeek wrote:
> On Thu, Dec 11, 2003 at 12:59:07AM -0000, remm@apache.org wrote:
>
>>remm 2003/12/10 16:59:07
>>
>> Modified: webapps/manager/WEB-INF/classes/org/apache/catalina/manager
>> StatusTransformer.java
>> Log:
>> - Add manager statistics for each context, as well as navigation links so that this
>> is actually useful. Somehow, the links don't work with Mozilla: it must be
>> because my HTML is very bad. IE works, though.
>
> [...]
>
>> - writer.print("<br/>");
>> + writer.print("<br>");
>
>
> The old way is actually "better", it lets you move toward XHTML.
> However, the way the "cool kids" do it is to leave a space before the
> "/" in body-less entities.
>
> <br />
> <hr />
> <img src="foo.gif" />
>
> This is the known "gentle" way to not freak out old browsers. Maybe
> I'll have to take a look at this class tonight and make it generate
> more proper HTML.
Do you know why my anchors don't work with Mozilla ?
Rémy
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager StatusTransformer.java
Posted by Kyle VanderBeek <ky...@kylev.com>.
On Thu, Dec 11, 2003 at 12:59:07AM -0000, remm@apache.org wrote:
> remm 2003/12/10 16:59:07
>
> Modified: webapps/manager/WEB-INF/classes/org/apache/catalina/manager
> StatusTransformer.java
> Log:
> - Add manager statistics for each context, as well as navigation links so that this
> is actually useful. Somehow, the links don't work with Mozilla: it must be
> because my HTML is very bad. IE works, though.
[...]
> - writer.print("<br/>");
> + writer.print("<br>");
The old way is actually "better", it lets you move toward XHTML.
However, the way the "cool kids" do it is to leave a space before the
"/" in body-less entities.
<br />
<hr />
<img src="foo.gif" />
This is the known "gentle" way to not freak out old browsers. Maybe
I'll have to take a look at this class tonight and make it generate
more proper HTML.
--
kylev@kylev.com
Some people have a way with words, while others... erm... thingy.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
Re: cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager
StatusTransformer.java
Posted by Tim Funk <fu...@joedog.org>.
The name attribute of <A> should be #less.
+ writer.print("<a class=\"A.name\" name=\"#"
+ + (count++) + ".0\">");
A page example which uses anchors:
http://jakarta.apache.org/tomcat/faq/tomcatuser.html
-Tim
remm@apache.org wrote:
> remm 2003/12/10 16:59:07
>
> Modified: webapps/manager/WEB-INF/classes/org/apache/catalina/manager
> StatusTransformer.java
> Log:
> - Add manager statistics for each context, as well as navigation links so that this
> is actually useful. Somehow, the links don't work with Mozilla: it must be
> because my HTML is very bad. IE works, though.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org