(felix-dev) branch master updated: Update documentation
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 298450bd0a Update documentation 298450bd0a is described below commit 298450bd0a240d17f39ffd4b9d3d2976b8b56dac Author: Carsten Ziegeler AuthorDate: Thu Dec 28 13:05:28 2023 +0100 Update documentation --- webconsole/EXTENSIONS.md | 189 ++ webconsole/README.md | 13 +- webconsole/RESTAPI.md| 335 +++ 3 files changed, 530 insertions(+), 7 deletions(-) diff --git a/webconsole/EXTENSIONS.md b/webconsole/EXTENSIONS.md new file mode 100644 index 00..fc52a7a75d --- /dev/null +++ b/webconsole/EXTENSIONS.md @@ -0,0 +1,189 @@ +# Extending the Apache Felix Web Console + +The Apache Felix Web Console is extensible in various ways. + +## Providing Web Console Plugins + +The Web Console can be extended by registering an OSGi service for the interface `jakarta.servlet.Servlet`. The respective service is called a Web Console Plugin or a plugin for short. + +The following table shows the required and optional registration properties. + +| Property | Description | +|---|---| +|`felix.webconsole.label`| A required string property with the label. The label is also used as a path segment in the URL to address the plugin. | +|`felix.webconsole.title`| A required string property for the title.| +|`felix.webconsole.css`|A single string, an array of strings or a collection of strings to be used as additional CSS resources which are automatically included in the head of the html page for the plugin. This property is optional.| + +If there are more than one plugin registered with the same label, the one with the highest service ranking is used. + +Before calling the servlet the web console sets these request attributes helping the plugin rendering the response: + +| Property | Description | +|---|---| +| `felix.webconsole.appRoot` | This request attribute of type `String` provides the absolute path of the Web Console root. This path consists of the servlet context path (from `ServletRequest.getContextPath()`) and the Web Console servlet path (from `HttpServletRequest.getServletPath()`, `/system/console` by default). This attribute can be used to provide absolute links to resources (images, CSS, scripts, etc.) or other plugins. This request attribute is available to client side JavaScri [...] +| `felix.webconsole.pluginRoot` | This request attribute of type `String` provides the absolute path of the current plugin. This path consists of the servlet context path (from `ServletRequest.getContextPath()`), the Web Console servlet path (from `HttpServletRequest.getServletPath()`, `/system/console` by default) and the plugin label. This attribute can be used to provide absolute links to the plugin itself. This request attribute is available to client side JavaScript as the global _` [...] + +The most basic plugin is a plain old Servlet whose `service(ServletRequest, ServletResponse)` method is called by the Apache Felix Web Console. For support is provided by extending the `org.apache.felix.webconsole.servlet.AbstractServlet` base class. In general the first approach is the preferred option as it does not create a dependency on web console API. + +### Plugin Logging + +The web console does not provide anything special for logging from within a plugin. As the web console is using slf4j, it is advisable to use the same logging mechanism. However, plugins are free to use other logging APIs. + +### Providing Resources + +All requests that are targetted at a plugin where the path starts with `/res/` are automatically handled as requests to resources. In this case the resources are searched inside the bundle providing the plugin. + +### Web Console Output Templating + +Templating and Internationalization support of the Web Console is based on Java Resource Bundles loaded from the plugin bundles and is transparent to the plugin itself. + +All html output generated by the plugin is filtered by the web console. This writer filter recognizes variables of the pattern `${name}` and tries to replace that part of the output with another string: + +* If a variable of that name exists, the value of that variable is used. See Variable Resolution below. +* Otherwise if a resource bundle provides a translated string for the name, that string is used. See Resource Bundles below. +* Otherwise the name itself is just placed in the output. + + Example + +Consider the plugin bundle provides a localization for the default german locale `de`: + +``` +OSGI-INF/l10n/bundle_de.properties: +Hello = Guten Tag +``` + +And the plugin defines a variable replacement and writes output with the following code: + +```java + this.getVariableResolver().put("world", "Schweiz"); + response.getWrit
(felix-dev) branch dependabot/maven/ipojo/runtime/core-it/commons-io-commons-io-2.7 created (now b287a861c5)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/ipojo/runtime/core-it/commons-io-commons-io-2.7 in repository https://gitbox.apache.org/repos/asf/felix-dev.git at b287a861c5 Bump commons-io:commons-io from 2.4 to 2.7 in /ipojo/runtime/core-it No new revisions were added by this update.
(felix-dev) branch dependabot/maven/ipojo/runtime/composite-it/commons-io-commons-io-2.7 created (now 00150a7ac6)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/ipojo/runtime/composite-it/commons-io-commons-io-2.7 in repository https://gitbox.apache.org/repos/asf/felix-dev.git at 00150a7ac6 Bump commons-io:commons-io in /ipojo/runtime/composite-it No new revisions were added by this update.
(felix-dev) branch master updated: Use latest parent pom 8 and fix doc urls
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 55d93c507f Use latest parent pom 8 and fix doc urls 55d93c507f is described below commit 55d93c507ff6869b842147d59ce897c3c1cd5dd6 Author: Carsten Ziegeler AuthorDate: Thu Dec 28 11:01:50 2023 +0100 Use latest parent pom 8 and fix doc urls --- webconsole/pom.xml | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webconsole/pom.xml b/webconsole/pom.xml index 1c5ccb987f..cdc281a080 100644 --- a/webconsole/pom.xml +++ b/webconsole/pom.xml @@ -22,7 +22,7 @@ org.apache.felix felix-parent -7 +8 ../pom/pom.xml @@ -33,8 +33,8 @@ Apache Felix Web Management Console Web Based Management Console for OSGi Frameworks. See -http://felix.apache.org/site/apache-felix-web-console.html for more -information on this bundle. +https://github.com/apache/felix-dev/tree/master/webconsole +for more information on this bundle. @@ -101,7 +101,7 @@ The Apache Software Foundation - https://felix.apache.org/site/apache-felix-web-console.html + https://github.com/apache/felix-dev/tree/master/webconsole org.apache.felix.webconsole.internal.OsgiManagerActivator
(felix-dev) branch master updated: FELIX-6654 : Remove support for commons fileupload
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 d84a3c37e6 FELIX-6654 : Remove support for commons fileupload d84a3c37e6 is described below commit d84a3c37e68334f1d80bfacc08233e3ac098a2f0 Author: Carsten Ziegeler AuthorDate: Thu Dec 28 10:55:34 2023 +0100 FELIX-6654 : Remove support for commons fileupload --- .../java/org/apache/felix/webconsole/internal/core/BundlesServlet.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0b098be148..190efc75c7 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 @@ -25,6 +25,7 @@ import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Array; import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.text.MessageFormat; import java.util.AbstractMap; import java.util.ArrayList; @@ -1497,7 +1498,7 @@ public class BundlesServlet extends AbstractOsgiManagerPlugin implements Invento // copy the data to a file for better processing tmpFile = File.createTempFile( "install", ".tmp" ); try (final InputStream bundleStream = part.getInputStream()) { -Files.copy(bundleStream, tmpFile.toPath()); +Files.copy(bundleStream, tmpFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } } catch ( final Exception e ) { Util.LOGGER.error("Problem accessing uploaded bundle file: {}", part.getSubmittedFileName(), e );
(felix-dev) branch master updated: FELIX-6638 : Migrate WebConsole to Jakarta Servlet API
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 def8da5730 FELIX-6638 : Migrate WebConsole to Jakarta Servlet API def8da5730 is described below commit def8da5730bc862c5889013912859916420e1bcc Author: Carsten Ziegeler AuthorDate: Thu Dec 28 10:27:26 2023 +0100 FELIX-6638 : Migrate WebConsole to Jakarta Servlet API --- .../felix/webconsole/DefaultBrandingPlugin.java| 51 +- 1 file changed, 49 insertions(+), 2 deletions(-) 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 032384f706..2ad5cd184c 100644 --- a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java +++ b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultBrandingPlugin.java @@ -86,12 +86,14 @@ import org.apache.felix.webconsole.internal.servlet.BrandingPluginImpl; * @deprecated Plugins should never use the branding plugin directly */ @Deprecated -public class DefaultBrandingPlugin extends BrandingPluginImpl implements BrandingPlugin { +public class DefaultBrandingPlugin implements BrandingPlugin { private static volatile DefaultBrandingPlugin instance; +private final BrandingPluginImpl delegate; + private DefaultBrandingPlugin() { -super(); +this.delegate = new BrandingPluginImpl(); } /** @@ -105,4 +107,49 @@ public class DefaultBrandingPlugin extends BrandingPluginImpl implements Brandin } return instance; } + +@Override +public String getBrandName() { +return delegate.getBrandName(); +} + +@Override +public String getFavIcon() { +return delegate.getFavIcon(); +} + +@Override +public String getMainStyleSheet() { +return delegate.getMainStyleSheet(); +} + +@Override +public String getProductImage() { +return delegate.getProductImage(); +} + +@Override +public String getProductName() { +return delegate.getProductName(); +} + +@Override +public String getProductURL() { +return delegate.getProductURL(); +} + +@Override +public String getVendorImage() { +return delegate.getVendorImage(); +} + +@Override +public String getVendorName() { +return delegate.getVendorName(); +} + +@Override +public String getVendorURL() { +return delegate.getVendorURL(); +} }