in java/org/apache/catalina/manager/StatusTransformer.java [513:671]
protected static void writeProcessorState(PrintWriter writer, ObjectName pName, MBeanServer mBeanServer, int mode)
throws Exception {
Integer stageValue = (Integer) mBeanServer.getAttribute(pName, "stage");
int stage = stageValue.intValue();
boolean fullStatus = true;
boolean showRequest = true;
String stageStr;
switch (stage) {
case org.apache.coyote.Constants.STAGE_PARSE:
stageStr = "P";
fullStatus = false;
break;
case org.apache.coyote.Constants.STAGE_PREPARE:
stageStr = "P";
fullStatus = false;
break;
case org.apache.coyote.Constants.STAGE_SERVICE:
stageStr = "S";
break;
case org.apache.coyote.Constants.STAGE_ENDINPUT:
stageStr = "F";
break;
case org.apache.coyote.Constants.STAGE_ENDOUTPUT:
stageStr = "F";
break;
case org.apache.coyote.Constants.STAGE_ENDED:
stageStr = "R";
fullStatus = false;
break;
case org.apache.coyote.Constants.STAGE_KEEPALIVE:
stageStr = "K";
showRequest = false;
break;
case org.apache.coyote.Constants.STAGE_NEW:
stageStr = "R";
fullStatus = false;
break;
default:
// Unknown stage
stageStr = "?";
fullStatus = false;
}
if (mode == 0) {
writer.write("<td><strong>");
writer.write(stageStr);
writer.write("</strong></td>");
if (fullStatus) {
writer.write("<td>");
writer.print(formatTime(mBeanServer.getAttribute(pName, "requestProcessingTime"), false));
writer.write("</td>");
writer.write("<td>");
if (showRequest) {
writer.print(formatSize(mBeanServer.getAttribute(pName, "requestBytesSent"), false));
} else {
writer.write("?");
}
writer.write("</td>");
writer.write("<td>");
if (showRequest) {
writer.print(formatSize(mBeanServer.getAttribute(pName, "requestBytesReceived"), false));
} else {
writer.write("?");
}
writer.write("</td>");
writer.write("<td>");
writer.print(Escape.htmlElementContent(mBeanServer.getAttribute(pName, "remoteAddrForwarded")));
writer.write("</td>");
writer.write("<td>");
writer.print(Escape.htmlElementContent(mBeanServer.getAttribute(pName, "remoteAddr")));
writer.write("</td>");
writer.write("<td nowrap>");
writer.write(Escape.htmlElementContent(mBeanServer.getAttribute(pName, "virtualHost")));
writer.write("</td>");
writer.write("<td nowrap class=\"row-left\">");
if (showRequest) {
writer.write(Escape.htmlElementContent(mBeanServer.getAttribute(pName, "method")));
writer.write(' ');
writer.write(Escape.htmlElementContent(mBeanServer.getAttribute(pName, "currentUri")));
String queryString = (String) mBeanServer.getAttribute(pName, "currentQueryString");
if (queryString != null && !queryString.isEmpty()) {
writer.write("?");
writer.print(Escape.htmlElementContent(queryString));
}
writer.write(' ');
writer.write(Escape.htmlElementContent(mBeanServer.getAttribute(pName, "protocol")));
} else {
writer.write("?");
}
writer.write("</td>");
} else {
writer.write("<td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td>");
}
} else if (mode == 1) {
writer.write("<worker ");
writer.write(" stage=\"" + stageStr + "\"");
if (fullStatus) {
writer.write(
" requestProcessingTime=\"" + mBeanServer.getAttribute(pName, "requestProcessingTime") + "\"");
writer.write(" requestBytesSent=\"");
if (showRequest) {
writer.write("" + mBeanServer.getAttribute(pName, "requestBytesSent"));
} else {
writer.write("0");
}
writer.write("\"");
writer.write(" requestBytesReceived=\"");
if (showRequest) {
writer.write("" + mBeanServer.getAttribute(pName, "requestBytesReceived"));
} else {
writer.write("0");
}
writer.write("\"");
writer.write(" remoteAddr=\"" +
Escape.htmlElementContent(mBeanServer.getAttribute(pName, "remoteAddr")) + "\"");
writer.write(" virtualHost=\"" +
Escape.htmlElementContent(mBeanServer.getAttribute(pName, "virtualHost")) + "\"");
if (showRequest) {
writer.write(
" method=\"" + Escape.htmlElementContent(mBeanServer.getAttribute(pName, "method")) + "\"");
writer.write(" currentUri=\"" +
Escape.htmlElementContent(mBeanServer.getAttribute(pName, "currentUri")) + "\"");
String queryString = (String) mBeanServer.getAttribute(pName, "currentQueryString");
if (queryString != null && !queryString.isEmpty()) {
writer.write(" currentQueryString=\"" + Escape.htmlElementContent(queryString) + "\"");
} else {
writer.write(" currentQueryString=\"?\"");
}
writer.write(" protocol=\"" +
Escape.htmlElementContent(mBeanServer.getAttribute(pName, "protocol")) + "\"");
} else {
writer.write(" method=\"?\"");
writer.write(" currentUri=\"?\"");
writer.write(" currentQueryString=\"?\"");
writer.write(" protocol=\"?\"");
}
} else {
writer.write(" requestProcessingTime=\"0\"");
writer.write(" requestBytesSent=\"0\"");
writer.write(" requestBytesReceived=\"0\"");
writer.write(" remoteAddr=\"?\"");
writer.write(" virtualHost=\"?\"");
writer.write(" method=\"?\"");
writer.write(" currentUri=\"?\"");
writer.write(" currentQueryString=\"?\"");
writer.write(" protocol=\"?\"");
}
writer.write(" />");
}
}