}
}
exchange.setResponseCode(200);
exchange.getResponseHeaders().add(new HttpString("Content-Type"), "text/html; charset=ISO-8859-1");
Sender resp = exchange.getResponseSender();
StringBuilder buf = new StringBuilder();
buf.append("<html><head>\n<title>Mod_cluster Status</title>\n</head><body>\n");
buf.append("<h1>" + MOD_CLUSTER_EXPOSED_VERSION + "</h1>");
String uri = exchange.getRequestPath();
String nonce = getNonce();
if (refreshTime <= 0)
buf.append("<a href=\"" + uri + "?" + nonce +
"&refresh=10" +
"\">Auto Refresh</a>");
buf.append(" <a href=\"" + uri + "?" + nonce +
"&Cmd=DUMP&Range=ALL" +
"\">show DUMP output</a>");
buf.append(" <a href=\"" + uri + "?" + nonce +
"&Cmd=INFO&Range=ALL" +
"\">show INFO output</a>");
buf.append("\n");
/* TODO sort the node by LBGroup (domain) */
String lbgroup = "";
for (Node node : container.getNodes()) {
NodeConfig nodeConfig = node.getNodeConfig();
if (!lbgroup.equals(nodeConfig.getDomain())) {
lbgroup = nodeConfig.getDomain();
if (reduceDisplay)
buf.append("<br/><br/>LBGroup " + lbgroup + ": ");
else
buf.append("<h1> LBGroup " + lbgroup + ": ");
if (allowCmd) {
domainCommandString(buf, uri, Status.ENABLED, lbgroup);
domainCommandString(buf, uri, Status.DISABLED, lbgroup);
}
}
if (reduceDisplay) {
buf.append("<br/><br/>Node " + nodeConfig.getJvmRoute());
printProxyStat(buf, node, reduceDisplay);
} else
buf.append("<h1> Node " + nodeConfig.getJvmRoute() + " (" + nodeConfig.getType() + "://" + nodeConfig.getHostname() + ":" + nodeConfig.getPort() + "): </h1>\n");
if (allowCmd) {
nodeCommandString(buf, uri, Status.ENABLED, nodeConfig.getJvmRoute());
nodeCommandString(buf, uri, Status.DISABLED, nodeConfig.getJvmRoute());
}
if (!reduceDisplay) {
buf.append("<br/>\n");
buf.append("Balancer: " + nodeConfig.getBalancer() + ",LBGroup: " + nodeConfig.getDomain());
String flushpackets = "off";
if (nodeConfig.isFlushPackets())
flushpackets = "Auto";
buf.append(",Flushpackets: " + flushpackets + ",Flushwait: " + nodeConfig.getFlushwait() + ",Ping: " + nodeConfig.getPing() + " ,Smax: " + nodeConfig.getPing() + ",Ttl: " + nodeConfig.getTtl());
printProxyStat(buf, node, reduceDisplay);
} else {
buf.append("<br/>\n");
}
// the sessionid list is mostly for demos.
if (displaySessionids)
buf.append(",Num sessions: " + container.getJVMRouteSessionCount(nodeConfig.getJvmRoute()));
buf.append("\n");
// Process the virtual-host of the node
printInfoHost(buf, uri, reduceDisplay, allowCmd, nodeConfig.getJvmRoute());
}
// Display the all the actives sessions
if (displaySessionids) {
printInfoSessions(buf, container.getSessionIds());
}
buf.append("</body></html>\n");
resp.send(buf.toString());
}