You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2013/04/26 11:01:41 UTC

svn commit: r1476116 - in /felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl: AbstractWebConsolePlugin.java DefaultWebConsolePlugin.java

Author: cziegeler
Date: Fri Apr 26 09:01:40 2013
New Revision: 1476116

URL: http://svn.apache.org/r1476116
Log:
FELIX-4037 :  URL parsing is not compatible with ConfigurationRender plugin 

Modified:
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java?rev=1476116&r1=1476115&r2=1476116&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java Fri Apr 26 09:01:40 2013
@@ -96,6 +96,11 @@ public abstract class AbstractWebConsole
         response.setHeader("Pragma", "no-cache"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
+    protected InventoryPrinterHandler getInventoryPrinterHandler(final String label)
+    {
+        return null; // all by default
+    }
+
     protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException,
         IOException
     {
@@ -103,9 +108,13 @@ public abstract class AbstractWebConsole
 
         // full request?
         final InventoryPrinterHandler handler;
-        if (request.getPathInfo().lastIndexOf('/') > 0)
-        {
-            handler = null; // all;
+        final String pathInfo = request.getPathInfo();
+        final int lastSlash = pathInfo.lastIndexOf('/');
+        if (lastSlash > 0)
+        {
+            final int lastDot = pathInfo.lastIndexOf('.');
+            final String label = (lastDot < lastSlash ? pathInfo.substring(lastSlash + 1) : pathInfo.substring(lastSlash + 1, lastDot));
+            handler = this.getInventoryPrinterHandler(label); // usually all;
         }
         else
         {

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java?rev=1476116&r1=1476115&r2=1476116&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java Fri Apr 26 09:01:40 2013
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,7 +33,7 @@ public class DefaultWebConsolePlugin ext
 
     /**
      * Constructor
-     * 
+     *
      * @param inventoryPrinterAdapter The adapter
      */
     DefaultWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager)
@@ -46,6 +46,11 @@ public class DefaultWebConsolePlugin ext
         return this;
     }
 
+    protected InventoryPrinterHandler getInventoryPrinterHandler(final String label)
+    {
+        return this.inventoryPrinterManager.getHandler(label);
+    }
+
     /**
      * @see org.apache.felix.inventory.impl.InventoryPrinterHandler#getTitle()
      */