FELIX-3132 Support requests to URLs adding an extension to the plugin label
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1175527 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
index 62cc6e7..d9bd052 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
@@ -19,22 +19,47 @@
import java.io.IOException;
import java.net.URL;
import java.text.MessageFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.GenericServlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FilenameUtils;
-import org.apache.felix.webconsole.*;
+import org.apache.felix.webconsole.AbstractWebConsolePlugin;
+import org.apache.felix.webconsole.BrandingPlugin;
+import org.apache.felix.webconsole.WebConsoleConstants;
+import org.apache.felix.webconsole.WebConsoleSecurityProvider;
import org.apache.felix.webconsole.internal.OsgiManagerPlugin;
import org.apache.felix.webconsole.internal.Util;
import org.apache.felix.webconsole.internal.core.BundlesServlet;
import org.apache.felix.webconsole.internal.filter.FilteringResponseWrapper;
import org.apache.felix.webconsole.internal.i18n.ResourceBundleManager;
import org.apache.felix.webconsole.internal.misc.ConfigurationRender;
-import org.apache.felix.webconsole.internal.servlet.PluginHolder.InternalPlugin;
-import org.osgi.framework.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.service.http.HttpContext;
import org.osgi.service.http.HttpService;
import org.osgi.service.log.LogService;
@@ -430,7 +455,18 @@
return holder.getPlugin(BundlesServlet.NAME);
}
- return holder.getPlugin(label);
+ AbstractWebConsolePlugin plugin = holder.getPlugin( label );
+ if ( plugin == null && label.indexOf( '.' ) > 0 )
+ {
+ int last = 0;
+ for ( int dot = label.indexOf( '.', last ); plugin == null && dot > last; last = dot + 1, dot = label
+ .indexOf( '.', last ) )
+ {
+ final String pluginLabel = label.substring( 0, dot );
+ plugin = holder.getPlugin( pluginLabel );
+ }
+ }
+ return plugin;
}
// See https://issues.apache.org/jira/browse/FELIX-2267