FELIX-4037 : URL parsing is not compatible with ConfigurationRender plugin
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1476116 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java b/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
index 5753be7..374267a 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
@@ -96,6 +96,11 @@
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 @@
// full request?
final InventoryPrinterHandler handler;
- if (request.getPathInfo().lastIndexOf('/') > 0)
+ final String pathInfo = request.getPathInfo();
+ final int lastSlash = pathInfo.lastIndexOf('/');
+ if (lastSlash > 0)
{
- handler = null; // all;
+ 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
{
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java b/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
index 1b2eca1..fbda404 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
@@ -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 @@
/**
* Constructor
- *
+ *
* @param inventoryPrinterAdapter The adapter
*/
DefaultWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager)
@@ -46,6 +46,11 @@
return this;
}
+ protected InventoryPrinterHandler getInventoryPrinterHandler(final String label)
+ {
+ return this.inventoryPrinterManager.getHandler(label);
+ }
+
/**
* @see org.apache.felix.inventory.impl.InventoryPrinterHandler#getTitle()
*/