Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Web Console can be extended by registering an OSGi service for the interface javax.servlet.Servlet with the service property felix.webconsole.label set to the label (last segment in the URL) of the page. The respective service is called a Web Console Plugin or a plugin for short.

The AbstractWebConsolePlugin

To leverage the rendering of the common header and footer around the plugin's data area, the plugin must extend the abstract org.apache.felix.webconsole.AbstractWebConsolePlugin class implementing the following methods:

  • renderContext(HttpServletRequest, HttpServletResponse) – This method is called to render the actual plugin data area.
  • getLabel() – Returns the last path segment of the plugin page. This should return the value to which the felix.webconsole.label service registration propery is set.
  • getTitle() – Returns a human readable title to be displayed at the top of the plugin page.

To fully leverage the AbstractWebConsolePlugin it must be initialiazed before registering the extension as a service. Likewise after unregistering the service, the plugin should be destroyed. To this avail the following methods are provided in the AbstractWebConsolePlugin:

  • activateBundle(BundleContext) – Initializes the plugin with the BundleContext and prepares some data to be rendered in the header and footer areas.
  • deactivate() – Destroys the plugin.

In addition to these OSGi-oriented setup methods the Web Console itself will call the Servlet.init(ServletConfig) method before putting the plugin into service and the Servlet.destroy() method when the plugin is removed.

Helper

Before calling the plugin the Web Console sets the org.apache.felix.webconsole.internal.servlet.OsgiManager.appRoot request attribute to the root path of the web console consisting of the servlet context path (HttpServletRequest.getContextPath()) and the servlet path of the web console (HttpServletRequest.getServletPath()). This request attribute may be used by plugins to render absolute links.

Further issues with respect to extensions

Task FELIX-1013 regarding extensibility of the web console is maintained in our resource tracking system. Please create issues regarding extensibility as subtasks of this master task or at least link to the master task as being related.

The following issues are already listed as part of FELIX-1013:

...

Please for to the Extending the Apache Felix Web Console for full documentation on extending the Apache Felix Web Console.

Issues

Top

Should you have any questions using the Web Console, please send a note to one of our Mailing Lists.

...