FELIX-1958 use the brand name (BrandingPlugin.getBrandName()) as the page title (together with the plugin title) and allow for its configuraiton through the properties file (webconsole.brand.name) in the DefaultBrandingPlugin
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@905657 13f79535-47bb-0310-9956-ffa450edef68
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 c374e18..4bbb13d 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
@@ -34,7 +34,6 @@
import org.apache.commons.fileupload.servlet.ServletRequestContext;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
public abstract class AbstractWebConsolePlugin extends HttpServlet
@@ -67,8 +66,6 @@
private BundleContext bundleContext;
- private String adminTitle;
-
private static BrandingPlugin brandingPlugin = DefaultBrandingPlugin.getInstance();
//---------- HttpServlet Overwrites ----------------------------------------
@@ -144,10 +141,6 @@
public void activate( BundleContext bundleContext )
{
this.bundleContext = bundleContext;
-
- Dictionary headers = bundleContext.getBundle().getHeaders();
-
- adminTitle = ( String ) headers.get( Constants.BUNDLE_NAME );
}
@@ -425,10 +418,10 @@
final String appRoot = ( String ) request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT );
String header = MessageFormat.format( getHeader(), new Object[]
- { adminTitle, getTitle(), appRoot, getLabel(), toUrl( brandingPlugin.getFavIcon(), appRoot ),
- toUrl( brandingPlugin.getMainStyleSheet(), appRoot ), brandingPlugin.getProductURL(),
- brandingPlugin.getProductName(), toUrl( brandingPlugin.getProductImage(), appRoot ),
- getCssLinks( appRoot ) } );
+ { brandingPlugin.getBrandName(), getTitle(), appRoot, getLabel(),
+ toUrl( brandingPlugin.getFavIcon(), appRoot ), toUrl( brandingPlugin.getMainStyleSheet(), appRoot ),
+ brandingPlugin.getProductURL(), brandingPlugin.getProductName(),
+ toUrl( brandingPlugin.getProductImage(), appRoot ), getCssLinks( appRoot ) } );
pw.println( header );
return pw;
@@ -619,7 +612,7 @@
private String getHeader()
{
// MessageFormat pattern place holder
- // 0 main title (plugin providing bundle name)
+ // 0 main title (brand name)
// 1 console plugin title
// 2 application root path (ATTR_APP_ROOT)
// 3 console plugin label (from the URI)
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 4e15b4e..96f73fd 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/BrandingPlugin.java
@@ -28,7 +28,9 @@
public interface BrandingPlugin
{
/**
- * Returns an indicative name of the branding plugin
+ * 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.
*/
String getBrandName();
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 706ed26..4429c24 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java
@@ -35,6 +35,11 @@
* <table>
* <tr><th>Name</th><th>Property Name</th><th>Default Value</th></tr>
* <tr>
+ * <td>Brand Name</td>
+ * <td>webconsole.brand.name</td>
+ * <td>Apache Felix Web Console</td>
+ * </tr>
+ * <tr>
* <td>Product Name</td>
* <td>webconsole.product.name</td>
* <td>Apache Felix</td>
@@ -92,6 +97,8 @@
private static DefaultBrandingPlugin instance;
+ private final String brandName;
+
private final String productName;
private final String productURL;
@@ -137,6 +144,7 @@
}
// set the fields from the properties now
+ brandName = props.getProperty( "webconsole.brand.name", "Apache Felix Web Console" );
productName = props.getProperty( "webconsole.product.name", "Apache Felix" );
productURL = props.getProperty( "webconsole.product.url", "http://felix.apache.org" );
productImage = props.getProperty( "webconsole.product.image", "/res/imgs/logo.png" );
@@ -160,7 +168,7 @@
public String getBrandName()
{
- return "DefaultBrandingPlugin";
+ return brandName;
}