4.4.2. Viewer Plug-ins

As an example, we'll create a simple viewer plug-in that allows to view the node's content as plain text.
First, we have to provide a class that implements the org.docma.plugin.web.ContentAppHandler interface. You can either create a new class from scratch, or extend the org.docma.plugin.web.DefaultContentAppHandler class, which provides a default implementation.
For this example, we'll create a class from scratch. The class name shall be myexample.MyTextViewer:
package myexample;

import java.io.File;
import org.docma.plugin.web.ContentAppHandler;

public class MyTextViewer implements ContentAppHandler
    private File relativePath;
    private String relativeURL;
    private String applicationId;

    // To do: implement the interface methods
In the class fragment given above, we've already declared three private fields that are used in the method implementations given below. Following a description of each interface method that needs to be implemented. The complete source code of the class is given afterwards.