felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1203908 - in /felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal: WhiteboardActivator.java manager/HttpWhiteboardWebConsolePlugin.java
Date Sat, 19 Nov 2011 00:13:50 GMT
Author: fmeschbe
Date: Sat Nov 19 00:13:49 2011
New Revision: 1203908

URL: http://svn.apache.org/viewvc?rev=1203908&view=rev
Log:
FELIX-3237 Add ConfigurationPrinter functionality to the plugin to get the same information
in Configuration Status dumps

Modified:
    felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java
    felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java

Modified: felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java?rev=1203908&r1=1203907&r2=1203908&view=diff
==============================================================================
--- felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java
(original)
+++ felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java
Sat Nov 19 00:13:49 2011
@@ -56,7 +56,9 @@ public final class WhiteboardActivator
         Hashtable<String, Object> props = new Hashtable<String, Object>();
         props.put("felix.webconsole.label", plugin.getLabel());
         props.put("felix.webconsole.title", plugin.getTitle());
-        props.put(Constants.SERVICE_DESCRIPTION, "Felix Http Whiteboard WebConsole Plugin");
+        props.put("felix.webconsole.configprinter.modes", new String[]
+            { "txt", "zip" });
+        props.put(Constants.SERVICE_DESCRIPTION, "Felix Http Whiteboard WebConsole Plugin
and Configuration Printer");
         httpPlugin = getBundleContext().registerService("javax.servlet.Servlet", plugin,
props);
 
         SystemLogger.info("Http service whiteboard started");

Modified: felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java?rev=1203908&r1=1203907&r2=1203908&view=diff
==============================================================================
--- felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
(original)
+++ felix/trunk/http/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
Sat Nov 19 00:13:49 2011
@@ -105,7 +105,7 @@ public class HttpWhiteboardWebConsolePlu
     private void printServletMappings(PrintWriter pw, Map<Object, AbstractMapping>
mappings)
     {
         pw.println("<tr>");
-        pw.println("<th class='content container' colspan='4'>Registered Filter and
Servlet Services</td>");
+        pw.println("<th class='content container' colspan='4'>Registered Servlet Services</td>");
         pw.println("</tr>");
         pw.println("<tr>");
         pw.println("<th class='content'>Alias</td>");
@@ -132,7 +132,7 @@ public class HttpWhiteboardWebConsolePlu
     private void printFilterMappings(PrintWriter pw, Map<Object, AbstractMapping> mappings)
     {
         pw.println("<tr>");
-        pw.println("<th class='content container' colspan='4'>Registered Filter and
Servlet Services</td>");
+        pw.println("<th class='content container' colspan='4'>Registered Filter Services</td>");
         pw.println("</tr>");
         pw.println("<tr>");
         pw.println("<th class='content'>Pattern</td>");
@@ -156,4 +156,52 @@ public class HttpWhiteboardWebConsolePlu
         }
     }
 
+    public void printConfiguration(final PrintWriter pw)
+    {
+        printHttpContextServicesTxt(pw);
+        final Map<Object, AbstractMapping> mappings = extMgr.getMappings();
+        printServletMappingsTxt(pw, mappings);
+        printFilterMappingsTxt(pw, mappings);
+    }
+
+    private void printHttpContextServicesTxt(PrintWriter pw)
+    {
+        pw.println("Registered HttpContext Services");
+        final Map<String, HttpContext> contexts = extMgr.getHttpContexts();
+        for (Map.Entry<String, HttpContext> handler : contexts.entrySet())
+        {
+            pw.println("  " + handler.getKey() + " ==> " + handler.getValue() + "</td>");
+        }
+        pw.println();
+    }
+
+    private void printServletMappingsTxt(PrintWriter pw, Map<Object, AbstractMapping>
mappings)
+    {
+        pw.println("Registered Servlet Services");
+        for (Map.Entry<Object, AbstractMapping> handler : mappings.entrySet())
+        {
+            if (handler.getValue() instanceof ServletMapping)
+            {
+                ServletMapping sm = (ServletMapping) handler.getValue();
+                pw.println("  " + sm.getAlias() + " ==> " + sm.getServlet() + " (" + sm.getInitParams()
+ ", "
+                    + sm.getContext() + ")");
+            }
+        }
+        pw.println();
+    }
+
+    private void printFilterMappingsTxt(PrintWriter pw, Map<Object, AbstractMapping>
mappings)
+    {
+        pw.println("Registered Filter Services");
+        for (Map.Entry<Object, AbstractMapping> handler : mappings.entrySet())
+        {
+            if (handler.getValue() instanceof FilterMapping)
+            {
+                FilterMapping fm = (FilterMapping) handler.getValue();
+                pw.println("  " + fm.getPattern() + " ==> " + fm.getFilter() + " (" +
fm.getRanking() + ", "
+                    + fm.getInitParams() + ", " + fm.getContext() + ")");
+            }
+        }
+        pw.println();
+    }
 }



Mime
View raw message