FELIX-3259 Improve WebConsole plugin
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1210837 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java b/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
index ec71339..14a07d0 100755
--- a/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
+++ b/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
@@ -159,32 +159,42 @@
pw.println("<tr>");
pw.println("<th class='content container' colspan='4'>Orphan Servlets and Filters</td>");
pw.println("</tr>");
- pw.println("<tr>");
- pw.println("<th class='content'>Context ID</td>");
- pw.println("<th class='content'>Servlets and Filters</td>");
- pw.println("</tr>");
-
- for (Entry<String, Set<AbstractMapping>> entry : mappings.entrySet())
+ if (mappings.isEmpty())
{
- pw.println("<tr class='content'>");
- pw.println("<td class='content'>" + entry.getKey() + "</td>");
- pw.println("<td class='content'>");
- for (AbstractMapping mapping : entry.getValue())
- {
- if (mapping instanceof ServletMapping)
- {
- pw.printf("Servlet %s (%s)", ((ServletMapping) mapping).getAlias(),
- ((ServletMapping) mapping).getServlet());
- }
- else if (mapping instanceof FilterMapping)
- {
- pw.printf("Filter %s (%s)", ((FilterMapping) mapping).getPattern(),
- ((FilterMapping) mapping).getFilter());
- }
- pw.println("<br/>");
- }
- pw.println("</td>");
+ pw.println("<tr>");
+ pw.println("<td class='content' colspan='4'><i>none</i></td>");
pw.println("</tr>");
+ pw.println("");
+ }
+ else
+ {
+ pw.println("<tr>");
+ pw.println("<th class='content'>Context ID</td>");
+ pw.println("<th class='content' colspan='3'>Servlets and Filters</td>");
+ pw.println("</tr>");
+
+ for (Entry<String, Set<AbstractMapping>> entry : mappings.entrySet())
+ {
+ pw.println("<tr class='content'>");
+ pw.println("<td class='content'>" + entry.getKey() + "</td>");
+ pw.println("<td class='content' colspan='3'>");
+ for (AbstractMapping mapping : entry.getValue())
+ {
+ if (mapping instanceof ServletMapping)
+ {
+ pw.printf("Servlet %s (%s)", ((ServletMapping) mapping).getAlias(),
+ ((ServletMapping) mapping).getServlet());
+ }
+ else if (mapping instanceof FilterMapping)
+ {
+ pw.printf("Filter %s (%s)", ((FilterMapping) mapping).getPattern(),
+ ((FilterMapping) mapping).getFilter());
+ }
+ pw.println("<br/>");
+ }
+ pw.println("</td>");
+ pw.println("</tr>");
+ }
}
}
@@ -232,33 +242,41 @@
private void printOrphanMappingsTxt(PrintWriter pw, Map<String, Set<AbstractMapping>> mappings)
{
pw.println("Orphan Servlets and Filters");
- for (Entry<String, Set<AbstractMapping>> entry : mappings.entrySet())
+ if (mappings.isEmpty())
{
- pw.print(entry.getKey() + " ==> { ");
- boolean cont = false;
- for (AbstractMapping mapping : entry.getValue())
- {
- if (cont)
- {
- pw.print(", ");
- }
- else
- {
- cont = true;
- }
+ pw.println(" none");
+ }
+ else
+ {
- if (mapping instanceof ServletMapping)
+ for (Entry<String, Set<AbstractMapping>> entry : mappings.entrySet())
+ {
+ pw.printf(" %s ==> { ", entry.getKey());
+ boolean cont = false;
+ for (AbstractMapping mapping : entry.getValue())
{
- pw.printf("Servlet %s (%s)", ((ServletMapping) mapping).getAlias(),
- ((ServletMapping) mapping).getServlet());
+ if (cont)
+ {
+ pw.print(", ");
+ }
+ else
+ {
+ cont = true;
+ }
+
+ if (mapping instanceof ServletMapping)
+ {
+ pw.printf("Servlet %s (%s)", ((ServletMapping) mapping).getAlias(),
+ ((ServletMapping) mapping).getServlet());
+ }
+ else if (mapping instanceof FilterMapping)
+ {
+ pw.printf("Filter %s (%s)", ((FilterMapping) mapping).getPattern(),
+ ((FilterMapping) mapping).getFilter());
+ }
}
- else if (mapping instanceof FilterMapping)
- {
- pw.printf("Filter %s (%s)", ((FilterMapping) mapping).getPattern(),
- ((FilterMapping) mapping).getFilter());
- }
+ pw.println(" }");
}
- pw.println(" }");
}
}