Sep 042014
 

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;
import java.io.InputStream;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;

@Path("/website")
public class ExamplePlugin extends PluginActivator {

@GET
@Path("/{id}")
@Produces("text/html")
public InputStream invokeExample() {
return getStaticResource("web/index.html");
}
}

 Posted by at 7:27 am

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)