This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 29b2311f4c FELIX-6631 : Migrate webconsole plugins to jakarta.servlet 
api
29b2311f4c is described below

commit 29b2311f4cd497f07566c1c4818851f4800da3f8
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Aug 21 16:53:25 2023 +0200

    FELIX-6631 : Migrate webconsole plugins to jakarta.servlet api
---
 .../felix/webconsole/AbstractWebConsolePlugin.java |  40 +++-
 .../apache/felix/webconsole/BrandingPlugin.java    |  83 +------
 .../felix/webconsole/DefaultBrandingPlugin.java    | 111 +++------
 .../felix/webconsole/WebConsoleConstants.java      |  33 +--
 .../apache/felix/webconsole/WebConsoleUtil.java    |  22 --
 .../webconsole/internal/OsgiManagerActivator.java  |  28 +--
 .../webconsole/internal/OsgiManagerPlugin.java     |   7 +-
 .../internal/configuration/ConfigManager.java      |   2 +-
 .../webconsole/internal/core/BundlesServlet.java   |   3 +-
 .../webconsole/internal/core/ServicesServlet.java  |   2 +-
 .../internal/filter/FilteringResponseWrapper.java  |   3 +-
 .../webconsole/internal/misc/LicenseServlet.java   |   2 +-
 .../webconsole/internal/servlet/OsgiManager.java   | 258 +++++++++++++--------
 .../webconsole/internal/system/VMStatPlugin.java   | 171 +++++---------
 .../servlet/RequestVariableResolver.java           |  33 ++-
 .../felix/webconsole/servlet/ServletConstants.java |  22 ++
 .../felix/webconsole/{ => spi}/BrandingPlugin.java |  13 +-
 .../apache/felix/webconsole/spi/package-info.java  |   2 +-
 18 files changed, 377 insertions(+), 458 deletions(-)

diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
index 4592249c36..557e943166 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
@@ -40,6 +40,7 @@ import java.util.TreeMap;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -134,9 +135,9 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
 
     private BundleContext bundleContext;
 
-    private static BrandingPlugin brandingPlugin = 
DefaultBrandingPlugin.getInstance();
+    private static volatile BrandingPlugin brandingPlugin = 
DefaultBrandingPlugin.getInstance();
 
-    private static int logLevel;
+    private static volatile int logLevel;
 
 
     //---------- HttpServlet Overwrites 
----------------------------------------
@@ -647,7 +648,7 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
             title = "${" + title.substring( 1 ) + "}";
         }
 
-        final RequestVariableResolver r = 
WebConsoleUtil.getRequestVariableResolver(request);
+        final RequestVariableResolver r = this.getVariableResolver(request);
         r.put("head.title", title);
         r.put("head.label", getLabel());
         r.put("head.cssLinks", getCssLinks(appRoot));
@@ -843,7 +844,9 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
      * branding.
      *
      * @return the brandingPlugin
+     * @deprecated
      */
+    @Deprecated
     public static BrandingPlugin getBrandingPlugin() {
         return AbstractWebConsolePlugin.brandingPlugin;
     }
@@ -856,7 +859,9 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
      * to update the branding plugin to use.
      *
      * @param brandingPlugin the brandingPlugin to set
+     * @deprecated
      */
+    @Deprecated
     public static final void setBrandingPlugin(BrandingPlugin brandingPlugin) {
         if(brandingPlugin == null){
             AbstractWebConsolePlugin.brandingPlugin = 
DefaultBrandingPlugin.getInstance();
@@ -865,7 +870,6 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
         }
     }
 
-
     /**
      * Sets the log level to be applied for calls to the {@link #log(int, 
String)}
      * and {@link #log(int, String, Throwable)} methods.
@@ -876,14 +880,11 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
      * @param logLevel the maximum allowed log level. If message is logged with
      *        lower level it will not be forwarded to the logger.
      */
-    public static final void setLogLevel( int logLevel )
-    {
+    public static final void setLogLevel( int logLevel ) {
         AbstractWebConsolePlugin.logLevel = logLevel;
     }
 
-
-    private final String getHeader()
-    {
+    private final String getHeader() {
         // MessageFormat pattern place holder
         //  0 main title (brand name)
         //  1 console plugin title
@@ -1055,6 +1056,27 @@ public abstract class AbstractWebConsolePlugin extends 
HttpServlet {
         return sortedMap;
     }
 
+        /**
+     * Returns the {@link RequestVariableResolver} for the given request.
+     * <p>
+     * The resolver is added to the request attributes via the web console main
+     * servlet before it invokes any plugins.
+     * The preset properties are
+     * <code>appRoot</code> set to the value of the
+     * {@link WebConsoleConstants#ATTR_APP_ROOT} request attribute and
+     * <code>pluginRoot</code> set to the value of the
+     * {@link WebConsoleConstants#ATTR_PLUGIN_ROOT} request attribute.
+     * <p>
+     *
+     * @param request The request whose attribute is returned 
+     *
+     * @return The {@link RequestVariableResolver} for the given request.
+     * @since 3.5.0
+     */
+    public RequestVariableResolver getVariableResolver( final ServletRequest 
request) {
+        return (RequestVariableResolver) request.getAttribute( 
RequestVariableResolver.REQUEST_ATTRIBUTE );
+    }
+
     @SuppressWarnings({ "rawtypes" })
     private static class MenuItem
     {
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
index 75774877f2..8286d1bd1f 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
@@ -25,86 +25,11 @@ import org.osgi.annotation.versioning.ConsumerType;
  * elaborate way of branding the web console.
  *
  * @see DefaultBrandingPlugin
+ * @deprecated Use {@link org.apache.felix.webconsole.spi.BrandingPlugin} 
instead.
  */
 @ConsumerType
-public interface BrandingPlugin {
-    /**
-     * Returns an indicative name of the branding plugin. This value is used
-     * as the Window/Page title together with the title of the respective
-     * plugin.
-     * 
-     * @return the name of the branding plugin
-     */
-    String getBrandName();
+@Deprecated
+public interface BrandingPlugin extends 
org.apache.felix.webconsole.spi.BrandingPlugin {
 
-
-    /**
-     * Returns the name of the product in which the web console is contained
-     * and to which the web console is branded.
-     *
-     * @return the product name
-     */
-    String getProductName();
-
-
-    /**
-     * Returns an (absolute) URL to a web site representing the product to
-     * which the web console is branded.
-     *
-     * @return the product URL
-     */
-    String getProductURL();
-
-
-    /**
-     * Returns an absolute path to an image to be rendered as the logo of the
-     * branding product.
-     *
-     * @return a path to an image - usually the product logo
-     */
-    String getProductImage();
-
-
-    /**
-     * Returns the name of the branding product vendor.
-     *
-     * @return the product vendor
-     */
-    String getVendorName();
-
-
-    /**
-     * Returns an (absolute) URL to the web site of the branding product
-     * vendor.
-     *
-     * @return the URL of the product vendor
-     */
-    String getVendorURL();
-
-
-    /**
-     * Returns an absolute path to an image to be rendered as the logo of the
-     * branding product vendor.
-     *
-     * @return the company logo
-     */
-    String getVendorImage();
-
-
-    /**
-     * Returns the absolute path to an icon to be used as the web console
-     * "favicon".
-     *
-     * @return path to an image, that is shown as favorite icon in the web 
browser
-     */
-    String getFavIcon();
-
-
-    /**
-     * Returns the absolute path to a CSS file to be used as the main CSS for
-     * the basic admin site.
-     *
-     * @return a path to a custom CSS. Used to override the default web 
console styling
-     */
-    String getMainStyleSheet();
+    // for compatibility
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java
index c4e1ed66bf..cd9359e640 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java
@@ -18,12 +18,10 @@
  */
 package org.apache.felix.webconsole;
 
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
 
-
 /**
  * The <code>DefaultBrandingPlugin</code> class is the default implementation
  * of the {@link BrandingPlugin} interface. The singleton instance of this
@@ -86,15 +84,17 @@ import java.util.Properties;
  * through the class loader of this class, the properties overwrite the default
  * settings according to the property names listed above. The easiest way to
  * add such a properties file is to provide a fragment bundle with the file.
+ *
+ * @deprecated Plugins should never use the branding plugin directly
  */
-public class DefaultBrandingPlugin implements BrandingPlugin
-{
+@Deprecated
+public class DefaultBrandingPlugin implements BrandingPlugin {
 
     /**
      * The name of the bundle entry providing branding properties for this
      * default branding plugin (value is "/META-INF/webconsole.properties").
      */
-    private static final String BRANDING_PROPERTIES = 
"/META-INF/webconsole.properties"; //$NON-NLS-1$
+    private static final String BRANDING_PROPERTIES = 
"/META-INF/webconsole.properties";
 
     private static DefaultBrandingPlugin instance;
 
@@ -116,9 +116,7 @@ public class DefaultBrandingPlugin implements BrandingPlugin
 
     private final String mainStyleSheet;
 
-
-    private DefaultBrandingPlugin()
-    {
+    private DefaultBrandingPlugin() {
         Properties props = new Properties();
 
         // try to load the branding properties
@@ -131,110 +129,71 @@ public class DefaultBrandingPlugin implements 
BrandingPlugin
         }
 
         // set the fields from the properties now
-        brandName = props.getProperty( "webconsole.brand.name", "Apache Felix 
Web Console" ); //$NON-NLS-1$
-        productName = props.getProperty( "webconsole.product.name", "Apache 
Felix" ); //$NON-NLS-1$
-        productURL = props.getProperty( "webconsole.product.url", 
"https://felix.apache.org"; ); //$NON-NLS-1$
-        productImage = props.getProperty( "webconsole.product.image", 
"/res/imgs/logo.png" ); //$NON-NLS-1$
-        vendorName = props.getProperty( "webconsole.vendor.name", "The Apache 
Software Foundation" ); //$NON-NLS-1$
-        vendorURL = props.getProperty( "webconsole.vendor.url", 
"https://www.apache.org"; ); //$NON-NLS-1$
-        vendorImage = props.getProperty( "webconsole.vendor.image", 
"/res/imgs/logo.png" ); //$NON-NLS-1$
-        favIcon = props.getProperty( "webconsole.favicon", 
"/res/imgs/favicon.ico" ); //$NON-NLS-1$
-        mainStyleSheet = props.getProperty( "webconsole.stylesheet", 
"/res/ui/webconsole.css" ); //$NON-NLS-1$
+        brandName = props.getProperty( "webconsole.brand.name", "Apache Felix 
Web Console" );
+        productName = props.getProperty( "webconsole.product.name", "Apache 
Felix" );
+        productURL = props.getProperty( "webconsole.product.url", 
"https://felix.apache.org"; );
+        productImage = props.getProperty( "webconsole.product.image", 
"/res/imgs/logo.png" );
+        vendorName = props.getProperty( "webconsole.vendor.name", "The Apache 
Software Foundation" );
+        vendorURL = props.getProperty( "webconsole.vendor.url", 
"https://www.apache.org"; );
+        vendorImage = props.getProperty( "webconsole.vendor.image", 
"/res/imgs/logo.png" );
+        favIcon = props.getProperty( "webconsole.favicon", 
"/res/imgs/favicon.ico" );
+        mainStyleSheet = props.getProperty( "webconsole.stylesheet", 
"/res/ui/webconsole.css" );
     }
 
-
     /**
      * Retrieves the shared instance
      * 
      * @return the singleton instance of the object
      */
-    public static DefaultBrandingPlugin getInstance()
-    {
-        if ( instance == null )
-        {
+    public static DefaultBrandingPlugin getInstance() {
+        if ( instance == null ) {
             instance = new DefaultBrandingPlugin();
         }
         return instance;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getBrandName()
-     */
-    public String getBrandName()
-    {
+    @Override
+    public String getBrandName() {
         return brandName;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getProductName()
-     */
-    public String getProductName()
-    {
+    @Override
+    public String getProductName() {
         return productName;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getProductURL()
-     */
-    public String getProductURL()
-    {
+    @Override
+    public String getProductURL() {
         return productURL;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getProductImage()
-     */
-    public String getProductImage()
-    {
+    @Override
+    public String getProductImage() {
         return productImage;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getVendorName()
-     */
-    public String getVendorName()
-    {
+    @Override
+    public String getVendorName() {
         return vendorName;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getVendorURL()
-     */
-    public String getVendorURL()
-    {
+    @Override
+    public String getVendorURL() {
         return vendorURL;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getVendorImage()
-     */
-    public String getVendorImage()
-    {
+    @Override
+    public String getVendorImage() {
         return vendorImage;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getFavIcon()
-     */
-    public String getFavIcon()
-    {
+    @Override
+    public String getFavIcon() {
         return favIcon;
     }
 
-
-    /**
-     * @see org.apache.felix.webconsole.BrandingPlugin#getMainStyleSheet()
-     */
-    public String getMainStyleSheet()
-    {
+    @Override
+    public String getMainStyleSheet() {
         return mainStyleSheet;
     }
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
index 4992106561..d87e747f42 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
@@ -24,14 +24,13 @@ import 
org.apache.felix.webconsole.servlet.RequestVariableResolver;
  * WebConsoleConstants provides some common constants that are used by plugin
  * developers.
  */
-public interface WebConsoleConstants
-{
+public interface WebConsoleConstants {
 
     /**
      * The name of the service to register as to be used as a "plugin" for
      * the OSGi Manager (value is "javax.servlet.Servlet").
      */
-    public static final String SERVICE_NAME = "javax.servlet.Servlet"; 
//$NON-NLS-1$
+    public static final String SERVICE_NAME = "javax.servlet.Servlet";
 
     /**
      * The URI address label under which the OSGi Manager plugin is called by
@@ -41,7 +40,7 @@ public interface WebConsoleConstants
      * String value. Otherwise the {@link #SERVICE_NAME Servlet} services will
      * be ignored by the Felix Web Console and not be used as a plugin.
      */
-    public static final String PLUGIN_LABEL = "felix.webconsole.label"; 
//$NON-NLS-1$
+    public static final String PLUGIN_LABEL = "felix.webconsole.label";
 
     /**
      * The title under which the OSGi Manager plugin is called by
@@ -60,7 +59,7 @@ public interface WebConsoleConstants
      *
      * @since 2.0.0
      */
-    public static final String PLUGIN_TITLE = "felix.webconsole.title"; 
//$NON-NLS-1$
+    public static final String PLUGIN_TITLE = "felix.webconsole.title";
 
     /**
      * The category under which the OSGi Manager plugin is listed in the top
@@ -81,7 +80,7 @@ public interface WebConsoleConstants
      *
      * @since 3.1.3; Web Console Bundle 4.0.2
      */
-    public static final String PLUGIN_CATEGORY = "felix.webconsole.category"; 
//$NON-NLS-1$
+    public static final String PLUGIN_CATEGORY = "felix.webconsole.category";
 
     /**
      * The property marking a service as a configuration printer.
@@ -94,8 +93,10 @@ public interface WebConsoleConstants
      * this property, it is treated as a configuration printer service.
      *
      * @since 3.1.2; Web Console Bundle 3.1.4
+     * @deprecated Use the Apache Felix Inventory API
      */
-    public static final String CONFIG_PRINTER_MODES = 
"felix.webconsole.configprinter.modes"; //$NON-NLS-1$
+    @Deprecated
+    public static final String CONFIG_PRINTER_MODES = 
"felix.webconsole.configprinter.modes";
 
     /**
      * Name of the optional service registration property indicating that a
@@ -106,8 +107,10 @@ public interface WebConsoleConstants
      * mode is escaped for plain text use.
      *
      * @since 3.1.2; Web Console Bundle 3.1.4
+     * @deprecated Use the Apache Felix Inventory API
      */
-    public static final String CONFIG_PRINTER_WEB_UNESCAPED = 
"felix.webconsole.configprinter.web.unescaped"; //$NON-NLS-1$
+    @Deprecated
+    public static final String CONFIG_PRINTER_WEB_UNESCAPED = 
"felix.webconsole.configprinter.web.unescaped";
 
     /**
      * The name of the service registration properties providing references
@@ -126,7 +129,7 @@ public interface WebConsoleConstants
      *
      * @since 2.0.0
      */
-    public static final String PLUGIN_CSS_REFERENCES = "felix.webconsole.css"; 
//$NON-NLS-1$
+    public static final String PLUGIN_CSS_REFERENCES = "felix.webconsole.css";
 
     /**
      * The name of the request attribute providing the absolute path of the
@@ -140,7 +143,7 @@ public interface WebConsoleConstants
      *
      * @since 2.0.0
      */
-    public static final String ATTR_APP_ROOT = "felix.webconsole.appRoot"; 
//$NON-NLS-1$
+    public static final String ATTR_APP_ROOT = "felix.webconsole.appRoot";
 
     /**
      * The name of the request attribute providing the absolute path of the
@@ -153,7 +156,7 @@ public interface WebConsoleConstants
      *
      * @since 1.2.12
      */
-    public static final String ATTR_PLUGIN_ROOT = 
"felix.webconsole.pluginRoot"; //$NON-NLS-1$
+    public static final String ATTR_PLUGIN_ROOT = 
"felix.webconsole.pluginRoot";
 
     /**
      * The name of the request attribute providing a mapping of labels to page
@@ -165,8 +168,10 @@ public interface WebConsoleConstants
      * The type of this request attribute is <code>Map&lt;String, 
String&gt;</code>.
      *
      * @since 2.0.0
+     * @deprecated Plugins should never create a navigation themselves
      */
-    public static final String ATTR_LABEL_MAP = "felix.webconsole.labelMap"; 
//$NON-NLS-1$
+    @Deprecated
+    public static final String ATTR_LABEL_MAP = "felix.webconsole.labelMap";
 
     /**
      * The name of the request attribute holding the {@link VariableResolver}
@@ -198,8 +203,10 @@ public interface WebConsoleConstants
      * renamed to the correct locale.
      *
      * @since 3.1.2
+     * @deprecated Plugins should never create a navigation themselves
      */
-    public static final String ATTR_LANG_MAP = "felix.webconsole.langMap"; 
//$NON-NLS-1$
+    @Deprecated
+    public static final String ATTR_LANG_MAP = "felix.webconsole.langMap";
     
     /**
      * The name of the request attribute holding the configuration params 
{@link java.util.Map}
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
index 408859482b..3a354fdabb 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
@@ -38,7 +38,6 @@ import org.apache.commons.fileupload.FileUploadException;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.apache.commons.fileupload.servlet.ServletRequestContext;
-import org.apache.felix.webconsole.servlet.RequestVariableResolver;
 
 
 /**
@@ -89,27 +88,6 @@ public final class WebConsoleUtil
         return resolver;
     }
 
-    /**
-     * Returns the {@link RequestVariableResolver} for the given request.
-     * <p>
-     * The resolver is added to the request attributes via the web console main
-     * servlet before it invokes any plugins.
-     * The preset properties are
-     * <code>appRoot</code> set to the value of the
-     * {@link WebConsoleConstants#ATTR_APP_ROOT} request attribute and
-     * <code>pluginRoot</code> set to the value of the
-     * {@link WebConsoleConstants#ATTR_PLUGIN_ROOT} request attribute.
-     * <p>
-     *
-     * @param request The request whose attribute is returned 
-     *
-     * @return The {@link RequestVariableResolver} for the given request.
-     * @since 3.5.0
-     */
-    public static RequestVariableResolver getRequestVariableResolver( final 
ServletRequest request) {
-        return (RequestVariableResolver) request.getAttribute( 
RequestVariableResolver.REQUEST_ATTRIBUTE );
-    }
-
     /**
      * Sets the {@link VariableResolver} as the
      * {@link WebConsoleConstants#ATTR_CONSOLE_VARIABLE_RESOLVER}
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
index a9000ee419..66e7bbd505 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
@@ -30,8 +30,7 @@ import 
org.osgi.service.http.whiteboard.annotations.RequireHttpWhiteboard;
  * the Apache Web Console upon bundle lifecycle requests.
  */
 @RequireHttpWhiteboard
-public class OsgiManagerActivator implements BundleActivator
-{
+public class OsgiManagerActivator implements BundleActivator {
 
     private OsgiManager osgiManager;
 
@@ -42,42 +41,31 @@ public class OsgiManagerActivator implements BundleActivator
     /**
      * @see 
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
      */
-    public void start( final BundleContext bundleContext ) throws Exception
-    {
+    public void start( final BundleContext bundleContext ) throws Exception {
         osgiManager = new OsgiManager( bundleContext );
-        try
-        {
+        try {
             final Class<?> activatorClass = 
bundleContext.getBundle().loadClass(STATUS_ACTIVATOR);
             this.statusActivator = (BundleActivator) 
activatorClass.getDeclaredConstructor().newInstance();
-
-        }
-        catch (Throwable t)
-        {
+        } catch (Throwable t) {
             // we ignore this as the status activator is only available if the 
web console
             // bundle contains the status bundle.
         }
-        if ( this.statusActivator != null)
-        {
+        if ( this.statusActivator != null) {
             this.statusActivator.start(bundleContext);
         }
     }
 
-
     /**
      * @see 
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
-    public void stop( final BundleContext bundleContext ) throws Exception
-    {
-        if ( this.statusActivator != null)
-        {
+    public void stop( final BundleContext bundleContext ) throws Exception {
+        if ( this.statusActivator != null) {
             this.statusActivator.stop(bundleContext);
             this.statusActivator = null;
         }
 
-        if ( osgiManager != null )
-        {
+        if ( osgiManager != null ) {
             osgiManager.dispose();
         }
     }
-
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java
index 35bdf04a2d..87613b1d8d 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java
@@ -18,17 +18,14 @@
  */
 package org.apache.felix.webconsole.internal;
 
-
 import org.osgi.framework.BundleContext;
 
-
 /**
  * OsgiManagerPlugin is an internal interface. When a plugin implements this
  * interface, the Web Console will run it's {@link #activate(BundleContext)} 
method upon
  * initialization and {@link #deactivate()}, when disposed.
  */
-public interface OsgiManagerPlugin
-{
+public interface OsgiManagerPlugin {
 
     /**
      * Category used for Web Console specific plugins.
@@ -52,11 +49,9 @@ public interface OsgiManagerPlugin
      */
     void activate( BundleContext bundleContext );
 
-
     /**
      * This method is called, by the Web Console to de-activate the plugin and 
release
      * all used resources.
      */
     void deactivate();
-
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigManager.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigManager.java
index 416edf8627..f358fce785 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigManager.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigManager.java
@@ -441,7 +441,7 @@ public class ConfigManager extends SimpleWebConsolePlugin 
implements OsgiManager
         final String referer = request.getParameter( REFERER );
         final boolean factoryCreate = "true".equals( 
request.getParameter(FACTORY_CREATE) );
 
-        final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+        final RequestVariableResolver vars = this.getVariableResolver(request);
         vars.put( "__data__", json.toString() ); 
         vars.put( "selectedPid", pid != null ? pid : "" );
         vars.put( "configurationReferer", referer != null ? referer : "" );
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
index e564c24e28..18c2ef1354 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
@@ -59,7 +59,6 @@ import org.apache.felix.utils.manifest.Parser;
 import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.apache.felix.webconsole.SimpleWebConsolePlugin;
 import org.apache.felix.webconsole.WebConsoleConstants;
-import org.apache.felix.webconsole.WebConsoleUtil;
 import org.apache.felix.webconsole.bundleinfo.BundleInfo;
 import org.apache.felix.webconsole.bundleinfo.BundleInfoProvider;
 import org.apache.felix.webconsole.internal.OsgiManagerPlugin;
@@ -530,7 +529,7 @@ public class BundlesServlet extends SimpleWebConsolePlugin 
implements OsgiManage
         final int startLevel = fsl.getInitialBundleStartLevel();
 
         // prepare variables
-        final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+        final RequestVariableResolver vars = this.getVariableResolver(request);
         vars.put( "startLevel", String.valueOf(startLevel));
         vars.put( "drawDetails", reqInfo.bundleRequested ? Boolean.TRUE : 
Boolean.FALSE );
         vars.put( "currentBundle", (reqInfo.bundleRequested && reqInfo.bundle 
!= null ? String.valueOf(reqInfo.bundle.getBundleId()) : "null"));
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
index 4f872e30d4..5f8ff81b8a 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
@@ -416,7 +416,7 @@ public class ServicesServlet extends SimpleWebConsolePlugin 
implements OsgiManag
         writeJSON(w, reqInfo.service, request.getLocale(), filter);
 
         // prepare variables
-        final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+        final RequestVariableResolver vars = this.getVariableResolver(request);
         vars.put( "bundlePath", appRoot +  "/" + BundlesServlet.NAME + "/" );
         vars.put( "drawDetails", String.valueOf(reqInfo.serviceRequested));
         vars.put( "__data__", w.toString() );
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/filter/FilteringResponseWrapper.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/filter/FilteringResponseWrapper.java
index 6d27cc099c..93a2e9786f 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/filter/FilteringResponseWrapper.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/filter/FilteringResponseWrapper.java
@@ -27,7 +27,6 @@ import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponseWrapper;
 
-import org.apache.felix.webconsole.WebConsoleUtil;
 import org.apache.felix.webconsole.servlet.RequestVariableResolver;
 
 
@@ -81,7 +80,7 @@ public class FilteringResponseWrapper extends 
HttpServletResponseWrapper {
         if ( writer == null ) {
             final PrintWriter base = super.getWriter();
             if ( doWrap() ) {
-                final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+                final RequestVariableResolver vars = (RequestVariableResolver) 
request.getAttribute(RequestVariableResolver.REQUEST_ATTRIBUTE);
                 final ResourceFilteringWriter filter = new 
ResourceFilteringWriter( base, locale, vars );
                 writer = new PrintWriter( filter );
             } else {
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
index dc12107f87..b0f55b45d9 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
@@ -115,7 +115,7 @@ public final class LicenseServlet extends 
SimpleWebConsolePlugin implements Osgi
         Util.sort( bundles, request.getLocale() );
 
         // prepare variables
-        final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+        final RequestVariableResolver vars = this.getVariableResolver(request);
         vars.put( "__data__", getBundleData( bundles, request.getLocale() ));
 
         res.getWriter().print(TEMPLATE);
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 e1b2b549c7..a9f7c92a87 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
@@ -52,13 +52,11 @@ import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-import org.apache.felix.webconsole.BrandingPlugin;
 import org.apache.felix.webconsole.User;
 import org.apache.felix.webconsole.WebConsoleConstants;
 import org.apache.felix.webconsole.WebConsoleSecurityProvider;
 import org.apache.felix.webconsole.WebConsoleSecurityProvider2;
 import org.apache.felix.webconsole.WebConsoleSecurityProvider3;
-import org.apache.felix.webconsole.WebConsoleUtil;
 import org.apache.felix.webconsole.internal.OsgiManagerPlugin;
 import org.apache.felix.webconsole.internal.Util;
 import org.apache.felix.webconsole.internal.core.BundlesServlet;
@@ -66,9 +64,13 @@ import 
org.apache.felix.webconsole.internal.filter.FilteringResponseWrapper;
 import org.apache.felix.webconsole.internal.i18n.ResourceBundleManager;
 import org.apache.felix.webconsole.internal.servlet.Plugin.InternalPlugin;
 import org.apache.felix.webconsole.servlet.RequestVariableResolver;
+import org.apache.felix.webconsole.servlet.ServletConstants;
+import org.apache.felix.webconsole.spi.BrandingPlugin;
 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.ServiceFactory;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
@@ -96,8 +98,7 @@ public class OsgiManager extends GenericServlet {
      * @deprecated use {@link WebConsoleConstants#ATTR_APP_ROOT} instead
      */
     @Deprecated
-    private static final String ATTR_APP_ROOT_OLD = OsgiManager.class.getName()
-        + ".appRoot";
+    private static final String ATTR_APP_ROOT_OLD = 
OsgiManager.class.getName() + ".appRoot";
 
     /**
      * Old name of the request attribute providing the mappings from label to
@@ -107,8 +108,7 @@ public class OsgiManager extends GenericServlet {
      * @deprecated use {@link WebConsoleConstants#ATTR_LABEL_MAP} instead
      */
     @Deprecated
-    private static final String ATTR_LABEL_MAP_OLD = 
OsgiManager.class.getName()
-        + ".labelMap";
+    private static final String ATTR_LABEL_MAP_OLD = 
OsgiManager.class.getName() + ".labelMap";
 
     /**
      * The name of the (internal) request attribute providing the categorized
@@ -127,49 +127,49 @@ public class OsgiManager extends GenericServlet {
      * The name of the cookie storing user-configured locale
      * See https://issues.apache.org/jira/browse/FELIX-2267
      */
-    private static final String COOKIE_LOCALE = "felix-webconsole-locale"; 
//$NON-NLS-1$
+    private static final String COOKIE_LOCALE = "felix-webconsole-locale";
 
-    private static final String FRAMEWORK_PROP_MANAGER_ROOT = 
"felix.webconsole.manager.root"; //$NON-NLS-1$
+    private static final String FRAMEWORK_PROP_MANAGER_ROOT = 
"felix.webconsole.manager.root";
 
-    private static final String FRAMEWORK_PROP_REALM = 
"felix.webconsole.realm"; //$NON-NLS-1$
+    private static final String FRAMEWORK_PROP_REALM = 
"felix.webconsole.realm";
 
-    private static final String FRAMEWORK_PROP_USER_NAME = 
"felix.webconsole.username"; //$NON-NLS-1$
+    private static final String FRAMEWORK_PROP_USER_NAME = 
"felix.webconsole.username";
 
-    private static final String FRAMEWORK_PROP_PASSWORD = 
"felix.webconsole.password"; //$NON-NLS-1$
+    private static final String FRAMEWORK_PROP_PASSWORD = 
"felix.webconsole.password";
 
-    private static final String FRAMEWORK_PROP_LOG_LEVEL = 
"felix.webconsole.loglevel"; //$NON-NLS-1$
+    private static final String FRAMEWORK_PROP_LOG_LEVEL = 
"felix.webconsole.loglevel";
 
-    private static final String FRAMEWORK_PROP_LOCALE = 
"felix.webconsole.locale"; //$NON-NLS-1$
+    private static final String FRAMEWORK_PROP_LOCALE = 
"felix.webconsole.locale";
 
-    private static final String FRAMEWORK_SHUTDOWN_TIMEOUT = 
"felix.webconsole.shutdown.timeout"; //$NON-NLS-1$
+    private static final String FRAMEWORK_SHUTDOWN_TIMEOUT = 
"felix.webconsole.shutdown.timeout";
 
-    private static final String FRAMEWORK_RELOAD_TIMEOUT = 
"felix.webconsole.reload.timeout"; //$NON-NLS-1$
+    private static final String FRAMEWORK_RELOAD_TIMEOUT = 
"felix.webconsole.reload.timeout";
 
-    static final String FRAMEWORK_PROP_SECURITY_PROVIDERS = 
"felix.webconsole.security.providers"; //$NON-NLS-1$
+    static final String FRAMEWORK_PROP_SECURITY_PROVIDERS = 
"felix.webconsole.security.providers";
 
-    static final String SECURITY_PROVIDER_PROPERTY_NAME = 
"webconsole.security.provider.id"; //$NON-NLS-1$
+    static final String SECURITY_PROVIDER_PROPERTY_NAME = 
"webconsole.security.provider.id";
 
-    static final String PROP_MANAGER_ROOT = "manager.root"; //$NON-NLS-1$
+    static final String PROP_MANAGER_ROOT = "manager.root";
 
-    static final String PROP_DEFAULT_RENDER = "default.render"; //$NON-NLS-1$
+    static final String PROP_DEFAULT_RENDER = "default.render";
 
-    static final String PROP_REALM = "realm"; //$NON-NLS-1$
+    static final String PROP_REALM = "realm";
 
-    static final String PROP_USER_NAME = "username"; //$NON-NLS-1$
+    static final String PROP_USER_NAME = "username";
 
-    static final String PROP_PASSWORD = "password"; //$NON-NLS-1$
+    static final String PROP_PASSWORD = "password";
 
-    static final String PROP_CATEGORY = "category"; //$NON-NLS-1$
+    static final String PROP_CATEGORY = "category";
 
-    static final String PROP_ENABLED_PLUGINS = "plugins"; //$NON-NLS-1$
+    static final String PROP_ENABLED_PLUGINS = "plugins";
 
-    static final String PROP_LOG_LEVEL = "loglevel"; //$NON-NLS-1$
+    static final String PROP_LOG_LEVEL = "loglevel";
 
-    static final String PROP_LOCALE = "locale"; //$NON-NLS-1$
+    static final String PROP_LOCALE = "locale";
 
-    static final String PROP_ENABLE_SECRET_HEURISTIC = 
"secret.heuristic.enabled"; //$NON-NLS-1$
+    static final String PROP_ENABLE_SECRET_HEURISTIC = 
"secret.heuristic.enabled";
 
-    static final String PROP_HTTP_SERVICE_SELECTOR = "http.service.filter"; 
//$NON-NLS-1$
+    static final String PROP_HTTP_SERVICE_SELECTOR = "http.service.filter";
     
     /** The framework shutdown timeout */
     public static final String PROP_SHUTDOWN_TIMEOUT = "shutdown.timeout";
@@ -181,53 +181,53 @@ public class OsgiManager extends GenericServlet {
 
     static final String DEFAULT_PAGE = BundlesServlet.NAME;
 
-    static final String DEFAULT_REALM = "OSGi Management Console"; 
//$NON-NLS-1$
+    static final String DEFAULT_REALM = "OSGi Management Console";
 
-    static final String DEFAULT_USER_NAME = "admin"; //$NON-NLS-1$
+    static final String DEFAULT_USER_NAME = "admin";
 
-    static final String DEFAULT_PASSWORD = 
"{sha-256}jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg="; //$NON-NLS-1$
+    static final String DEFAULT_PASSWORD = 
"{sha-256}jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=";
 
-    static final String DEFAULT_CATEGORY = "Main"; //$NON-NLS-1$
+    static final String DEFAULT_CATEGORY = "Main";
 
-    static final int DEFAULT_SHUTDOWN_TIMEOUT = 5; //$NON-NLS-1$
+    static final int DEFAULT_SHUTDOWN_TIMEOUT = 5;
 
-    static final int DEFAULT_RELOAD_TIMEOUT = 40; //$NON-NLS-1$
+    static final int DEFAULT_RELOAD_TIMEOUT = 40;
 
     /** Default value for secret heuristics */
     public static final boolean DEFAULT_ENABLE_SECRET_HEURISTIC = false;
 
-    private static final String HEADER_AUTHORIZATION = "Authorization"; 
//$NON-NLS-1$
+    private static final String HEADER_AUTHORIZATION = "Authorization";
 
-    private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate"; 
//$NON-NLS-1$
+    private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
 
     /**
      * The default value for the {@link #PROP_MANAGER_ROOT} configuration
      * property (value is "/system/console").
      */
-    static final String DEFAULT_MANAGER_ROOT = "/system/console"; //$NON-NLS-1$
+    static final String DEFAULT_MANAGER_ROOT = "/system/console";
 
-    private static final String OLD_CONFIG_MANAGER_CLASS = 
"org.apache.felix.webconsole.internal.compendium.ConfigManager"; //$NON-NLS-1$
-    private static final String NEW_CONFIG_MANAGER_CLASS = 
"org.apache.felix.webconsole.internal.configuration.ConfigManager"; 
//$NON-NLS-1$
+    private static final String OLD_CONFIG_MANAGER_CLASS = 
"org.apache.felix.webconsole.internal.compendium.ConfigManager";
+    private static final String NEW_CONFIG_MANAGER_CLASS = 
"org.apache.felix.webconsole.internal.configuration.ConfigManager";
 
     static final String[] PLUGIN_CLASSES = {
-            
"org.apache.felix.webconsole.internal.configuration.ConfigurationAdminConfigurationPrinter",
 //$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.compendium.PreferencesConfigurationPrinter",
 //$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.compendium.WireAdminConfigurationPrinter",
 //$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.core.BundlesConfigurationPrinter", 
//$NON-NLS-1$
-            "org.apache.felix.webconsole.internal.core.CapabilitiesPrinter", 
//$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.core.FrameworkPropertiesPrinter", 
//$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.core.PermissionsConfigurationPrinter", 
//$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.core.ServicesConfigurationPrinter", 
//$NON-NLS-1$
-            
"org.apache.felix.webconsole.internal.misc.SystemPropertiesPrinter", 
//$NON-NLS-1$
-            "org.apache.felix.webconsole.internal.misc.ThreadPrinter", }; 
//$NON-NLS-1$
+            
"org.apache.felix.webconsole.internal.configuration.ConfigurationAdminConfigurationPrinter",
+            
"org.apache.felix.webconsole.internal.compendium.PreferencesConfigurationPrinter",
+            
"org.apache.felix.webconsole.internal.compendium.WireAdminConfigurationPrinter",
+            
"org.apache.felix.webconsole.internal.core.BundlesConfigurationPrinter",
+            "org.apache.felix.webconsole.internal.core.CapabilitiesPrinter",
+            
"org.apache.felix.webconsole.internal.core.FrameworkPropertiesPrinter",
+            
"org.apache.felix.webconsole.internal.core.PermissionsConfigurationPrinter",
+            
"org.apache.felix.webconsole.internal.core.ServicesConfigurationPrinter",
+            
"org.apache.felix.webconsole.internal.misc.SystemPropertiesPrinter",
+            "org.apache.felix.webconsole.internal.misc.ThreadPrinter", };
 
     static final String[] PLUGIN_MAP = {
-            NEW_CONFIG_MANAGER_CLASS, "configMgr", //$NON-NLS-1$ //$NON-NLS-2$
-            "org.apache.felix.webconsole.internal.compendium.LogServlet", 
"logs", //$NON-NLS-1$ //$NON-NLS-2$
-            "org.apache.felix.webconsole.internal.core.BundlesServlet", 
"bundles", //$NON-NLS-1$ //$NON-NLS-2$
-            "org.apache.felix.webconsole.internal.core.ServicesServlet", 
"services", //$NON-NLS-1$ //$NON-NLS-2$
-            "org.apache.felix.webconsole.internal.misc.LicenseServlet", 
"licenses", //$NON-NLS-1$ //$NON-NLS-2$
-            "org.apache.felix.webconsole.internal.system.VMStatPlugin", 
"vmstat", //$NON-NLS-1$ //$NON-NLS-2$
+            NEW_CONFIG_MANAGER_CLASS, "configMgr",
+            "org.apache.felix.webconsole.internal.compendium.LogServlet", 
"logs",
+            "org.apache.felix.webconsole.internal.core.BundlesServlet", 
"bundles",
+            "org.apache.felix.webconsole.internal.core.ServicesServlet", 
"services",
+            "org.apache.felix.webconsole.internal.misc.LicenseServlet", 
"licenses",
+            "org.apache.felix.webconsole.internal.system.VMStatPlugin", 
"vmstat",
     };
 
     private static final String SERVLEXT_CONTEXT_NAME = 
"org.apache.felix.webconsole";
@@ -296,28 +296,19 @@ public class OsgiManager extends GenericServlet {
 
         // setup the included plugins
         ClassLoader classLoader = getClass().getClassLoader();
-        for (int i = 0; i < PLUGIN_CLASSES.length; i++)
-        {
-            String pluginClassName = PLUGIN_CLASSES[i];
+        for (int i = 0; i < PLUGIN_CLASSES.length; i++) {
+            final String pluginClassName = PLUGIN_CLASSES[i];
 
-            try
-            {
+            try {
                 final Class<?> pluginClass = 
classLoader.loadClass(pluginClassName);
                 final Object plugin = 
pluginClass.getDeclaredConstructor().newInstance();
 
-                if (plugin instanceof OsgiManagerPlugin)
-                {
+                if (plugin instanceof OsgiManagerPlugin) {
                     final OsgiManagerPlugin p = (OsgiManagerPlugin)plugin;
                     p.activate(bundleContext);
                     osgiManagerPlugins.add(p);
                 }
-                if (plugin instanceof BrandingPlugin)
-                {
-                    
AbstractWebConsolePlugin.setBrandingPlugin((BrandingPlugin) plugin);
-                }
-            }
-            catch (NoClassDefFoundError ncdfe)
-            {
+            } catch (NoClassDefFoundError ncdfe) {
                 String message = ncdfe.getMessage();
                 if (message == null)
                 {
@@ -379,7 +370,7 @@ public class OsgiManager extends GenericServlet {
         updateConfiguration(null);
 
         // register managed service as a service factory
-        this.configurationListener = bundleContext.registerService( 
"org.osgi.service.cm.ManagedService", //$NON-NLS-1$
+        this.configurationListener = bundleContext.registerService( 
"org.osgi.service.cm.ManagedService",
             new ServiceFactory()
             {
                 @Override
@@ -414,8 +405,8 @@ public class OsgiManager extends GenericServlet {
             }, new Hashtable<String, Object>()
             {
                 {
-                    put( Constants.SERVICE_VENDOR, "The Apache Software 
Foundation" ); //$NON-NLS-1$
-                    put( Constants.SERVICE_DESCRIPTION, "OSGi Management 
Console Configuration Receiver" ); //$NON-NLS-1$
+                    put( Constants.SERVICE_VENDOR, "The Apache Software 
Foundation" );
+                    put( Constants.SERVICE_DESCRIPTION, "OSGi Management 
Console Configuration Receiver" );
                     put( Constants.SERVICE_PID, getConfigurationPid() );
                 }
             } );
@@ -579,7 +570,7 @@ public class OsgiManager extends GenericServlet {
             return;
         }
 
-        int slash = pathInfo.indexOf("/", 1); //$NON-NLS-1$
+        int slash = pathInfo.indexOf("/", 1);
         if (slash < 2)
         {
             slash = pathInfo.length();
@@ -593,11 +584,11 @@ public class OsgiManager extends GenericServlet {
         {
             final String body404 = MessageFormat.format(
                 
resourceBundleManager.getResourceBundle(bundleContext.getBundle(), 
locale).getString(
-                    "404"), //$NON-NLS-1$
+                    "404"),
                 new Object[] { request.getContextPath() + 
request.getServletPath() + '/'
                     + BundlesServlet.NAME });
-            response.setCharacterEncoding("utf-8"); //$NON-NLS-1$
-            response.setContentType("text/html"); //$NON-NLS-1$
+            response.setCharacterEncoding("utf-8");
+            response.setContentType("text/html");
             response.setStatus(HttpServletResponse.SC_NOT_FOUND);
             response.getWriter().println(body404);
 
@@ -612,16 +603,14 @@ public class OsgiManager extends GenericServlet {
         request.setAttribute(WebConsoleConstants.ATTR_LANG_MAP, getLangMap());
         request.setAttribute(WebConsoleConstants.ATTR_LABEL_MAP, flatLabelMap);
         request.setAttribute( ATTR_LABEL_MAP_CATEGORIZED, labelMap );
-        request.setAttribute(WebConsoleConstants.ATTR_APP_ROOT,
-            request.getContextPath() + request.getServletPath());
-        request.setAttribute(WebConsoleConstants.ATTR_PLUGIN_ROOT,
-            request.getContextPath() + request.getServletPath() + '/' + label);
-        request.setAttribute(WebConsoleConstants.ATTR_CONFIGURATION, 
configuration);
+        final String appRoot = 
request.getContextPath().concat(request.getServletPath());
+        request.setAttribute(ServletConstants.ATTR_APP_ROOT, appRoot);
+        request.setAttribute(ServletConstants.ATTR_PLUGIN_ROOT, 
appRoot.concat("/").concat(label));
+        request.setAttribute(ServletConstants.ATTR_CONFIGURATION, 
configuration);
 
         // deprecated request attributes
         request.setAttribute(ATTR_LABEL_MAP_OLD, flatLabelMap);
-        request.setAttribute(ATTR_APP_ROOT_OLD,
-            request.getContextPath() + request.getServletPath());
+        request.setAttribute(ATTR_APP_ROOT_OLD, appRoot);
 
         // fix for https://issues.apache.org/jira/browse/FELIX-3408
         ensureLocaleCookieSet(request, response, locale);
@@ -639,8 +628,8 @@ public class OsgiManager extends GenericServlet {
     private void initRequestVariableResolver(final HttpServletRequest request) 
{
         final RequestVariableResolver resolver = new RequestVariableResolver();
         request.setAttribute(RequestVariableResolver.REQUEST_ATTRIBUTE, 
resolver);
-        resolver.put( "appRoot", (String) request.getAttribute( 
WebConsoleConstants.ATTR_APP_ROOT ) );
-        resolver.put( "pluginRoot", (String) request.getAttribute( 
WebConsoleConstants.ATTR_PLUGIN_ROOT ) );
+        resolver.put( RequestVariableResolver.KEY_APP_ROOT, (String) 
request.getAttribute( ServletConstants.ATTR_APP_ROOT ) );
+        resolver.put( RequestVariableResolver.KEY_PLUGIN_ROOT, (String) 
request.getAttribute( ServletConstants.ATTR_PLUGIN_ROOT ) );
     }
 
     private final void logout(HttpServletRequest request, HttpServletResponse 
response)
@@ -697,7 +686,7 @@ public class OsgiManager extends GenericServlet {
     {
         // backwards compatibility for the former "install" action which is
         // used by the Maven Sling Plugin
-        if ("install".equals(label)) //$NON-NLS-1$
+        if ("install".equals(label))
         {
             return holder.getPlugin(BundlesServlet.NAME);
         }
@@ -871,24 +860,37 @@ public class OsgiManager extends GenericServlet {
         return new FilteringResponseWrapper(response, resourceBundle, request);
     }
 
-    private static class BrandingServiceTracker extends 
ServiceTracker<BrandingPlugin, BrandingPlugin>
-    {
-        BrandingServiceTracker(OsgiManager osgiManager)
-        {
-            super(osgiManager.getBundleContext(), BrandingPlugin.class, null);
+    @SuppressWarnings("deprecation")
+    private static class BrandingServiceTracker extends 
ServiceTracker<BrandingPlugin, BrandingPlugin> {
+
+        private static Filter createFilter(final BundleContext context) {
+            try {
+                final Filter filter = context.createFilter("(|(" + 
Constants.OBJECTCLASS + "="
+                        + BrandingPlugin.class.getName() + ")" + "(" + 
Constants.OBJECTCLASS + "=" + 
org.apache.felix.webconsole.BrandingPlugin.class.getName() + "))");
+                return filter;
+            } catch (final InvalidSyntaxException e) {
+                // fail loud and clear
+                throw new InternalError(e);
+            }
+        }
+
+        public BrandingServiceTracker(final OsgiManager osgiManager) {
+            super(osgiManager.getBundleContext(), 
createFilter(osgiManager.getBundleContext()), null);
         }
 
         @Override
-        public BrandingPlugin addingService(ServiceReference<BrandingPlugin> 
reference)
-        {
-            BrandingPlugin plugin = super.addingService(reference);
-            AbstractWebConsolePlugin.setBrandingPlugin( plugin);
+        public BrandingPlugin addingService(ServiceReference<BrandingPlugin> 
reference) {
+            final BrandingPlugin plugin = super.addingService(reference);
+            if (plugin instanceof org.apache.felix.webconsole.BrandingPlugin) {
+                
AbstractWebConsolePlugin.setBrandingPlugin((org.apache.felix.webconsole.BrandingPlugin)plugin);
+            } else {
+                AbstractWebConsolePlugin.setBrandingPlugin(new 
BrandingPluginAdapter(plugin));
+            }
             return plugin;
         }
 
         @Override
-        public void removedService(ServiceReference<BrandingPlugin> reference, 
BrandingPlugin service)
-        {
+        public void removedService(ServiceReference<BrandingPlugin> reference, 
BrandingPlugin service) {
             AbstractWebConsolePlugin.setBrandingPlugin(null);
             try {
                 super.removedService(reference, service);
@@ -896,7 +898,61 @@ public class OsgiManager extends GenericServlet {
                 // ignore this as the service is already invalid
             }
         }
+    }
+
+    @SuppressWarnings("deprecation")
+    private static class BrandingPluginAdapter implements 
org.apache.felix.webconsole.BrandingPlugin {
+
+        private final BrandingPlugin p;
+
+        public BrandingPluginAdapter(final BrandingPlugin p) {
+            this.p = p;
+        }
+
+        @Override
+        public String getBrandName() {
+            return p.getBrandName();
+        }
 
+        @Override
+        public String getFavIcon() {
+            return p.getFavIcon();
+        }
+
+        @Override
+        public String getMainStyleSheet() {
+            return p.getMainStyleSheet();
+        }
+
+        @Override
+        public String getProductImage() {
+            return p.getProductImage();
+        }
+
+        @Override
+        public String getProductName() {
+            return p.getProductName();
+        }
+
+        @Override
+        public String getProductURL() {
+            return p.getProductURL();
+        }
+
+        @Override
+        public String getVendorImage() {
+            return p.getVendorImage();
+        }
+
+        @Override
+        public String getVendorName() {
+            return p.getVendorName();
+        }
+
+        @Override
+        public String getVendorURL() {
+            return p.getVendorURL();
+        }
     }
 
     synchronized void registerHttpWhiteboardServices() {
@@ -1018,8 +1074,8 @@ public class OsgiManager extends GenericServlet {
 
         // get the web manager root path
         String newWebManagerRoot = ConfigurationUtil.getProperty(config, 
PROP_MANAGER_ROOT, DEFAULT_MANAGER_ROOT);
-        if (!newWebManagerRoot.startsWith("/")) { //$NON-NLS-1$
-            newWebManagerRoot = "/".concat(newWebManagerRoot); //$NON-NLS-1$
+        if (!newWebManagerRoot.startsWith("/")) {
+            newWebManagerRoot = "/".concat(newWebManagerRoot);
         }
 
         // default category
@@ -1106,7 +1162,7 @@ public class OsgiManager extends GenericServlet {
             return langMap;
         final Map<String, String> map = new HashMap<>();
         final Bundle bundle = bundleContext.getBundle();
-        final Enumeration<URL> e = bundle.findEntries("res/flags", null, 
false); //$NON-NLS-1$
+        final Enumeration<URL> e = bundle.findEntries("res/flags", null, 
false);
         while (e != null && e.hasMoreElements())
         {
             final URL img = e.nextElement();
@@ -1115,7 +1171,7 @@ public class OsgiManager extends GenericServlet {
                 final int lastSlash = path.lastIndexOf('/');
                 final int dot = path.indexOf('.', lastSlash);
                 final String name = (dot == -1 ? path.substring(lastSlash+1) : 
path.substring(lastSlash + 1, dot));
-                final String locale = new Locale(name, 
"").getDisplayLanguage(); //$NON-NLS-1$
+                final String locale = new Locale(name, 
"").getDisplayLanguage();
                 map.put(name, null != locale ? locale : name);
             }
             catch (Throwable t) {
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
index 226a2195c9..0c1f73771b 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.webconsole.internal.system;
 
-
 import java.io.IOException;
 import java.io.StringWriter;
 import java.text.DateFormat;
@@ -39,34 +38,29 @@ import 
org.apache.felix.webconsole.internal.servlet.OsgiManager;
 import org.apache.felix.webconsole.servlet.RequestVariableResolver;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
-import org.osgi.service.startlevel.StartLevel;
-
+import org.osgi.framework.Constants;
+import org.osgi.framework.startlevel.FrameworkStartLevel;
 
 /**
  * VMStatPlugin provides the System Information tab. This particular plugin 
uses
  * more than one templates.
  */
-public class VMStatPlugin extends SimpleWebConsolePlugin implements 
OsgiManagerPlugin
-{
+public class VMStatPlugin extends SimpleWebConsolePlugin implements 
OsgiManagerPlugin {
 
     private static final long serialVersionUID = 2293375003997163600L;
 
-    private static final String LABEL = "vmstat"; //$NON-NLS-1$
-    private static final String TITLE = "%vmstat.pluginTitle"; //$NON-NLS-1$
+    private static final String LABEL = "vmstat";
+    private static final String TITLE = "%vmstat.pluginTitle";
     private static final String CSS[] = null;
 
-    private static final String ATTR_TERMINATED = "terminated"; //$NON-NLS-1$
+    private static final String ATTR_TERMINATED = "terminated";
 
-    private static final String PARAM_SHUTDOWN_TIMER = "shutdown_timer"; 
//$NON-NLS-1$
-    private static final String PARAM_SHUTDOWN_TYPE = "shutdown_type"; 
//$NON-NLS-1$
-    private static final String PARAM_SHUTDOWN_TYPE_RESTART = "Restart"; 
//$NON-NLS-1$
-    //private static final String PARAM_SHUTDOWN_TYPE_STOP = "Stop";
+    private static final String PARAM_SHUTDOWN_TIMER = "shutdown_timer";
+    private static final String PARAM_SHUTDOWN_TYPE = "shutdown_type";
+    private static final String PARAM_SHUTDOWN_TYPE_RESTART = "Restart";
 
     private static final long startDate = System.currentTimeMillis();
 
-    // from BaseWebConsolePlugin
-    private static String START_LEVEL_NAME = StartLevel.class.getName();
-
     // templates
     private final String TPL_VM_MAIN;
     private final String TPL_VM_STOP;
@@ -74,85 +68,63 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
 
 
     /** Default constructor */
-    public VMStatPlugin()
-    {
+    public VMStatPlugin() {
         super( LABEL, TITLE, CATEGORY_OSGI_MANAGER, CSS );
 
         // load templates
-        TPL_VM_MAIN = readTemplateFile(  "/templates/vmstat.html"  ); 
//$NON-NLS-1$
-        TPL_VM_STOP = readTemplateFile( "/templates/vmstat_stop.html" ); 
//$NON-NLS-1$
-        TPL_VM_RESTART = readTemplateFile( "/templates/vmstat_restart.html" ); 
//$NON-NLS-1$
+        TPL_VM_MAIN = readTemplateFile(  "/templates/vmstat.html"  );
+        TPL_VM_STOP = readTemplateFile( "/templates/vmstat_stop.html" );
+        TPL_VM_RESTART = readTemplateFile( "/templates/vmstat_restart.html" );
     }
 
-
     /**
      * @see 
javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse)
      */
-    protected void doPost( HttpServletRequest request, HttpServletResponse 
response ) throws ServletException,
-    IOException
-    {
-        final String action = request.getParameter( "action"); //$NON-NLS-1$
-
-        if ( "setStartLevel".equals( action )) //$NON-NLS-1$
-        {
-            StartLevel sl = getStartLevel();
-            if ( sl != null )
-            {
+    protected void doPost( HttpServletRequest request, HttpServletResponse 
response )
+    throws ServletException, IOException {
+        final String action = request.getParameter( "action");
+
+        if ( "setStartLevel".equals( action )) {
+            final FrameworkStartLevel fsl = 
this.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkStartLevel.class);
+            if ( fsl != null ){
                 int bundleSL = WebConsoleUtil.getParameterInt( request, 
"bundleStartLevel", -1 );
-                if ( bundleSL > 0 && bundleSL != 
sl.getInitialBundleStartLevel() )
-                {
-                    sl.setInitialBundleStartLevel( bundleSL );
+                if ( bundleSL > 0 && bundleSL != 
fsl.getInitialBundleStartLevel() ) {
+                    fsl.setInitialBundleStartLevel( bundleSL );
                 }
 
                 int systemSL = WebConsoleUtil.getParameterInt( request, 
"systemStartLevel", -1 );
-                if ( systemSL > 0 && systemSL != sl.getStartLevel() )
-                {
-                    sl.setStartLevel( systemSL );
+                if ( systemSL > 0 && systemSL != fsl.getStartLevel() ) {
+                    fsl.setStartLevel( systemSL );
                 }
             }
-        }
-        else if ( "gc".equals( action ) ) //$NON-NLS-1$
-        {
+        } else if ( "gc".equals( action ) )  {
             System.gc();
             System.gc(); // twice for sure
-        }
-        else if ( request.getParameter( PARAM_SHUTDOWN_TIMER ) == null )
-        {
+        } else if ( request.getParameter( PARAM_SHUTDOWN_TIMER ) == null ) {
 
             // whether to stop or restart the framework
             final boolean restart = PARAM_SHUTDOWN_TYPE_RESTART.equals( 
request.getParameter( PARAM_SHUTDOWN_TYPE ) );
 
             // simply terminate VM in case of shutdown :-)
             final Bundle systemBundle = getBundleContext().getBundle( 0 );
-            Thread t = new Thread( "Stopper" )
-            {
-                public void run()
-                {
-                    try
-                    {
+            Thread t = new Thread( "Stopper" ) {
+                public void run() {
+                    try {
                         Thread.sleep( 2000L );
-                    }
-                    catch ( InterruptedException ie )
-                    {
+                    } catch ( InterruptedException ie ) {
                         // ignore
                     }
 
                     log( "Shutting down server now!" );
 
                     // stopping bundle 0 (system bundle) stops the framework
-                    try
-                    {
-                        if ( restart )
-                        {
+                    try {
+                        if ( restart ) {
                             systemBundle.update();
-                        }
-                        else
-                        {
+                        } else {
                             systemBundle.stop();
                         }
-                    }
-                    catch ( BundleException be )
-                    {
+                    } catch ( BundleException be ) {
                         log( "Problem stopping or restarting the Framework", 
be );
                     }
                 }
@@ -160,27 +132,24 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
             t.start();
 
             request.setAttribute( ATTR_TERMINATED, ATTR_TERMINATED );
-            request.setAttribute( PARAM_SHUTDOWN_TYPE, new Boolean( restart ) 
);
+            request.setAttribute( PARAM_SHUTDOWN_TYPE, restart );
         }
 
         // render the response without redirecting
         doGet( request, response );
     }
 
+    @Override
+    @SuppressWarnings("unchecked")
+    protected void renderContent( HttpServletRequest request, 
HttpServletResponse response ) throws IOException {
+        final FrameworkStartLevel fsl = 
this.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkStartLevel.class);
 
-    /**
-     * @see 
org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest,
 javax.servlet.http.HttpServletResponse)
-     */
-    protected void renderContent( HttpServletRequest request, 
HttpServletResponse response ) throws IOException
-    {
         Map<String, Object> configuration = (Map<String, Object>) 
request.getAttribute( WebConsoleConstants.ATTR_CONFIGURATION );
         String body;
 
-        if ( request.getAttribute( ATTR_TERMINATED ) != null )
-        {
+        if ( request.getAttribute( ATTR_TERMINATED ) != null ) {
             Object restart = request.getAttribute( PARAM_SHUTDOWN_TYPE );
-            if ( ( restart instanceof Boolean ) && ( ( Boolean ) restart 
).booleanValue() )
-            {
+            if ( ( restart instanceof Boolean ) && ( ( Boolean ) restart 
).booleanValue() ) {
                 StringWriter json = new StringWriter();
 
                 int reloadTimeout = (int) configuration.get( 
OsgiManager.PROP_RELOAD_TIMEOUT );
@@ -190,13 +159,11 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
                 jw.endObject();
                 jw.flush();
 
-                final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+                final RequestVariableResolver vars = 
this.getVariableResolver(request);
                 vars.put( "data", json.toString() );
 
                 body = TPL_VM_RESTART;
-            }
-            else
-            {
+            } else {
                 body = TPL_VM_STOP;
             }
             response.getWriter().print( body );
@@ -211,8 +178,9 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
 
         boolean shutdownTimer = request.getParameter( PARAM_SHUTDOWN_TIMER ) 
!= null;
         String shutdownType = request.getParameter( PARAM_SHUTDOWN_TYPE );
-        if ( shutdownType == null )
+        if ( shutdownType == null ) {
             shutdownType = "";
+        }
 
         DateFormat format = DateFormat.getDateTimeInstance( DateFormat.LONG, 
DateFormat.LONG, request.getLocale() );
         final String startTime = format.format( new Date( startDate ) );
@@ -222,8 +190,8 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
         JSONWriter jw = new JSONWriter(json);
         jw.object();
 
-        jw.key( "systemStartLevel").value(getStartLevel().getStartLevel() );
-        jw.key( 
"bundleStartLevel").value(getStartLevel().getInitialBundleStartLevel() );
+        jw.key( "systemStartLevel").value(fsl.getStartLevel() );
+        jw.key( "bundleStartLevel").value(fsl.getInitialBundleStartLevel() );
         jw.key( "lastStarted").value(startTime );
         jw.key( "upTime").value(upTime );
         jw.key( "runtime").value(sysProp( "java.runtime.name" ) + "(build "
@@ -241,8 +209,7 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
 
         // only add the processors if the number is available
         final int processors = getAvailableProcessors();
-        if ( processors > 0 )
-        {
+        if ( processors > 0 ) {
             jw.key( "processors").value(processors );
         }
 
@@ -250,58 +217,38 @@ public class VMStatPlugin extends SimpleWebConsolePlugin 
implements OsgiManagerP
 
         jw.flush();
 
-        final RequestVariableResolver vars = 
WebConsoleUtil.getRequestVariableResolver(request);
+        final RequestVariableResolver vars = this.getVariableResolver(request);
         vars.put( "startData", json.toString() );
 
         response.getWriter().print( body );
     }
 
-    private static final String sysProp( String name )
-    {
+    private static final String sysProp( String name ) {
         String ret = System.getProperty( name );
         if ( null == ret || ret.length() == 0 ) {
-            ret = "n/a"; //$NON-NLS-1$
+            ret = "n/a";
         }
         return ret;
     }
 
-
-    private static final String formatPeriod( final long period )
-    {
-        final Long msecs = new Long( period % 1000 );
-        final Long secs = new Long( period / 1000 % 60 );
-        final Long mins = new Long( period / 1000 / 60 % 60 );
-        final Long hours = new Long( period / 1000 / 60 / 60 % 24 );
-        final Long days = new Long( period / 1000 / 60 / 60 / 24 );
+    private static final String formatPeriod( final long period ) {
+        final long msecs = period % 1000;
+        final long secs = period / 1000 % 60;
+        final long mins = period / 1000 / 60 % 60;
+        final long hours = period / 1000 / 60 / 60 % 24;
+        final long days = period / 1000 / 60 / 60 / 24;
         return MessageFormat.format(
                 "{0,number} '${vmstat.upTime.format.days}' 
{1,number,00}:{2,number,00}:{3,number,00}.{4,number,000}",
                 new Object[]
                         { days, hours, mins, secs, msecs } );
     }
 
-
-    private final StartLevel getStartLevel()
-    {
-        return ( StartLevel ) getService( START_LEVEL_NAME );
-    }
-
-
     /**
      * Returns the number of processor available on Java 1.4 and newer 
runtimes.
      * If the Runtime.availableProcessors() method is not available, this
      * method returns -1.
      */
-    private static final int getAvailableProcessors()
-    {
-        try
-        {
-            return Runtime.getRuntime().availableProcessors();
-        }
-        catch ( Throwable t )
-        {
-            // NoSuchMethodError on pre-1.4 runtimes
-        }
-
-        return -1;
+    private static final int getAvailableProcessors() {
+        return Runtime.getRuntime().availableProcessors();
     }
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/servlet/RequestVariableResolver.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/servlet/RequestVariableResolver.java
index 4efdc3aacd..7ced6500a3 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/servlet/RequestVariableResolver.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/servlet/RequestVariableResolver.java
@@ -20,6 +20,8 @@ package org.apache.felix.webconsole.servlet;
 
 import java.util.HashMap;
 
+import jakarta.servlet.ServletRequest;
+
 /**
  * The <code>RequestVariableResolver</code> is a <code>HashMap</code> that
  * is used by the webconsole to process variables in the template.
@@ -31,11 +33,24 @@ public class RequestVariableResolver extends 
HashMap<String, Object> {
     /**
      * The name of the request attribute holding the {@link 
RequestVariableResolver}
      * for the request (value is "felix.webconsole.variable.resolver").
-     *
-     * @since 3.0
+     * This attribute is guaaranteed to be set for plugins.
      */
     public static final String REQUEST_ATTRIBUTE = 
"felix.webconsole.variable.resolver";
 
+    /**
+     * The name of the key providing the absolute path of the Web Console root.
+     * This key is guaaranteed to be set for plugins.
+     * @see ServletConstants.ATTR_APP_ROOT
+     */
+    public static final String KEY_APP_ROOT = "appRoot";
+
+    /**
+     * The name of the key providing the absolute path of the current plugin.
+     * This key is guaaranteed to be set for plugins.
+     * @see ServletConstants.ATTR_PLUGIN_ROOT
+     */
+    public static final String KEY_PLUGIN_ROOT = "pluginRoot";
+
     /**
      * Creates a new variable resolver with default capacity.
      */
@@ -59,4 +74,18 @@ public class RequestVariableResolver extends HashMap<String, 
Object> {
         }
         return null;
     }
+
+    /**
+     * Returns the {@link RequestVariableResolver} for the given request.
+     * <p>
+     * The resolver is added to the request attributes via the web console main
+     * servlet before it invokes any plugins.
+     * @param request The request
+     * @return The {@link RequestVariableResolver} for the given request.
+     * @see #KEY_APP_ROOT
+     * @see #KEY_PLUGIN_ROOT
+     */
+    public static RequestVariableResolver getRequestVariableResolver( final 
ServletRequest request) {
+        return (RequestVariableResolver) request.getAttribute( 
RequestVariableResolver.REQUEST_ATTRIBUTE );
+    }
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/servlet/ServletConstants.java
 
b/webconsole/src/main/java/org/apache/felix/webconsole/servlet/ServletConstants.java
index 7b5f2f1431..4a10889274 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/servlet/ServletConstants.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/servlet/ServletConstants.java
@@ -72,4 +72,26 @@ public abstract class ServletConstants {
      * The type of this request attribute is <code>String</code>.
      */
     public static final String ATTR_APP_ROOT = "felix.webconsole.appRoot";
+
+    /**
+     * The name of the request attribute providing the absolute path of the
+     * current plugin (value is "felix.webconsole.pluginRoot"). This consists 
of
+     * the servlet context path (from 
<code>ServletRequest.getContextPath()</code>),
+     * the configured path of the web console root 
(<code>/system/console</code>
+     * by default) and the plugin label {@link #PLUGIN_LABEL}.
+     * <p>
+     * The type of this request attribute is <code>String</code>.
+     */
+    public static final String ATTR_PLUGIN_ROOT = 
"felix.webconsole.pluginRoot";
+
+    /**
+     * The name of the request attribute holding the configuration params 
{@link java.util.Map}
+     * for the request (value is "felix.webconsole.configuration").
+     * <p>
+     * The type of this request attribute is <code>Map&lt;String, 
Object&gt;</code>.
+     * <p>
+     * This map contains the web console configuration params managed by the 
web console.
+     * It can be used to access to the configuration values while processing 
requests.
+     */
+    public static final String ATTR_CONFIGURATION = 
"felix.webconsole.configuration";
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/spi/BrandingPlugin.java
similarity index 97%
copy from 
webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
copy to 
webconsole/src/main/java/org/apache/felix/webconsole/spi/BrandingPlugin.java
index 75774877f2..e73ff420b8 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/spi/BrandingPlugin.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.webconsole;
+package org.apache.felix.webconsole.spi;
 
 import org.osgi.annotation.versioning.ConsumerType;
 
@@ -24,10 +24,11 @@ import org.osgi.annotation.versioning.ConsumerType;
  * The <code>BrandingPlugin</code> is the service interface for the most
  * elaborate way of branding the web console.
  *
- * @see DefaultBrandingPlugin
+ * @since 1.2.0
  */
 @ConsumerType
 public interface BrandingPlugin {
+
     /**
      * Returns an indicative name of the branding plugin. This value is used
      * as the Window/Page title together with the title of the respective
@@ -37,7 +38,6 @@ public interface BrandingPlugin {
      */
     String getBrandName();
 
-
     /**
      * Returns the name of the product in which the web console is contained
      * and to which the web console is branded.
@@ -46,7 +46,6 @@ public interface BrandingPlugin {
      */
     String getProductName();
 
-
     /**
      * Returns an (absolute) URL to a web site representing the product to
      * which the web console is branded.
@@ -55,7 +54,6 @@ public interface BrandingPlugin {
      */
     String getProductURL();
 
-
     /**
      * Returns an absolute path to an image to be rendered as the logo of the
      * branding product.
@@ -64,7 +62,6 @@ public interface BrandingPlugin {
      */
     String getProductImage();
 
-
     /**
      * Returns the name of the branding product vendor.
      *
@@ -72,7 +69,6 @@ public interface BrandingPlugin {
      */
     String getVendorName();
 
-
     /**
      * Returns an (absolute) URL to the web site of the branding product
      * vendor.
@@ -81,7 +77,6 @@ public interface BrandingPlugin {
      */
     String getVendorURL();
 
-
     /**
      * Returns an absolute path to an image to be rendered as the logo of the
      * branding product vendor.
@@ -90,7 +85,6 @@ public interface BrandingPlugin {
      */
     String getVendorImage();
 
-
     /**
      * Returns the absolute path to an icon to be used as the web console
      * "favicon".
@@ -99,7 +93,6 @@ public interface BrandingPlugin {
      */
     String getFavIcon();
 
-
     /**
      * Returns the absolute path to a CSS file to be used as the main CSS for
      * the basic admin site.
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/spi/package-info.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/spi/package-info.java
index da3a407a37..966e63eb77 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/spi/package-info.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/spi/package-info.java
@@ -16,6 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
[email protected]("1.1.0")
[email protected]("1.2.0")
 package org.apache.felix.webconsole.spi;
 

Reply via email to