简体   繁体   中英

Apache Felix Web Console does not find image with absolute path

In order to add my own branding to the Apache Felix Web Console , I registered a BrandingPlugin service as described here . However, I cannot get it to correctly display my logo. For testing, I added the absolute path to my svg in my BrandingPlugin like this:

import org.apache.felix.webconsole.BrandingPlugin;
import org.apache.felix.webconsole.DefaultBrandingPlugin;
import org.osgi.service.component.annotations.Component;

@Component(service = BrandingPlugin.class)
public class MyBrandingPlugin implements BrandingPlugin {

    @Override
    public String getBrandName() {
        return "My company name";
    }

    @Override
    public String getProductName() {
        return "My product name";
    }

    @Override
    public String getProductURL() {
        return "https://www.my-website.com/";
    }

    @Override
    public String getProductImage() {
       return "/home/fbaierl/Repos/myproduct/Runnables/OSGi/branding/logo.svg";
    }

    @Override
    public String getVendorName() {
        return DefaultBrandingPlugin.getInstance().getVendorName();
    }

    @Override
    public String getVendorURL() {
        return DefaultBrandingPlugin.getInstance().getVendorURL();
    }

    @Override
    public String getVendorImage() {
        return DefaultBrandingPlugin.getInstance().getVendorImage();
    }

    @Override
    public String getFavIcon() {
        return DefaultBrandingPlugin.getInstance().getFavIcon();
    }

    @Override
    public String getMainStyleSheet() {
        return DefaultBrandingPlugin.getInstance().getMainStyleSheet();
    }
}

When I navigate to the Webconsole, I can see that getBrandName , getProductName and getProductUrl all work as expected. However, the image linked to in getProductImage is not displayed.

The resulting html looks like this:

<img src="/system/console/home/fbaierl/Repos/myproduct/Runnables/OSGi/branding/logo.svg" alt="Logo">

Does anyone know how I can get the logo to be displayed correctly?

我可能会尝试使用前缀文件:以及一些斜线(文件:/文件://文件:///)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM