MCPcopy Create free account
hub / github.com/apache/tomcat / list

Method list

java/org/apache/catalina/manager/ManagerServlet.java:1044–1073  ·  view source on GitHub ↗

Render a list of the currently active Contexts in our virtual host. @param writer Writer to render to @param smClient i18n support for current client's locale

(PrintWriter writer, StringManager smClient)

Source from the content-addressed store, hash-verified

1042 * @param smClient i18n support for current client's locale
1043 */
1044 protected void list(PrintWriter writer, StringManager smClient) {
1045
1046 if (debug >= 1) {
1047 log("list: Listing contexts for virtual host '" + host.getName() + "'");
1048 }
1049
1050 writer.println(smClient.getString("managerServlet.listed", host.getName()));
1051 Container[] contexts = host.findChildren();
1052 for (Container container : contexts) {
1053 Context context = (Context) container;
1054 if (context != null) {
1055 String displayPath = context.getPath();
1056 if (displayPath.isEmpty()) {
1057 displayPath = "/";
1058 }
1059 List<String> parts;
1060 if (context.getState().isAvailable()) {
1061 int sessionCount = 0;
1062 Manager manager = context.getManager();
1063 if (manager != null) {
1064 sessionCount = manager.findSessions().length;
1065 }
1066 parts = Arrays.asList(displayPath, "running", "" + sessionCount, context.getDocBase());
1067 } else {
1068 parts = Arrays.asList(displayPath, "stopped", "0", context.getDocBase());
1069 }
1070 writer.println(StringUtils.join(parts, ':'));
1071 }
1072 }
1073 }
1074
1075
1076 /**

Callers 1

doGetMethod · 0.95

Calls 13

getPathMethod · 0.95
getManagerMethod · 0.95
findSessionsMethod · 0.95
getDocBaseMethod · 0.95
joinMethod · 0.95
logMethod · 0.65
getNameMethod · 0.65
getStringMethod · 0.65
findChildrenMethod · 0.65
isAvailableMethod · 0.65
getStateMethod · 0.65
printlnMethod · 0.45

Tested by

no test coverage detected