How to serve static content via dynamic service?

A DeepaMehta(DM) plugin can publish static resources and dynamic resources.

A DM plugin automatically publishes the Static resources (files) that are in resource/web directory. They will be published in the URI specified in bundle symbolic name in the pom.xml

A DM plugin can also publish dynamic resources created by java code, by providing a DeepaMehta RESTful service. To do so, you should define a method where you call getStaticResource to access a resource from the plugin, this method returns an Inputstream. The resources will be published in the URI obtained from the @path annotation defined in the plugin, and the resource method should be annotated with @Produces(“text/html”).

An example:

package de.example;

import de.deepamehta.core.osgi.PluginActivator;

public class ExamplePlugin extends PluginActivator {

public InputStream invokeExample() {
return getStaticResource("web/index.html");

Leave a Comment

Your email address will not be published. Required fields are marked *