By default, VirtualViewer will use its built-in sample handler. This example contains that code that you can build your handler from. This example is provided as-is and should not be used in production.
The VirtualViewer API documentation is located here and here
At the time this document was written, when using https://repo.snowbound.com/ as your Maven repository, we support version 5.6.0 and newer. If you require an older version, please visit our main support page at http://www.snowbound.com/support or contact us at +1-617-607-2010.
- Java JDK 1.8 or newer
- VirtualViewer 5.3 and 5.4 require JDK 11
- Apache Maven
- To make development easier, the
mvncommand should be part of your systemPATHvariable. - On most Linux distros, this will be added automaticly if you install via the package manager.
- On Windows, add the Maven
bindirectory to your PATH environmental variable.
- To make development easier, the
Before making any modifications, we recomend you run this command to make sure your system is in a sane state. Using the command line, run mvn clean verify. You will find the JAR(s) will output to target/deploy. If you prefer to use an IDE, you will need one that supports Maven based projects. We (Snowbound) do not recomend any particular IDE as this is a personal preference.
In 2019 the Java EE framework changed ownership and was renamed to Jakarta EE. Using Jakarta requires changing some namespace imports and dependent libraries, but is required to use the updates in Jakarta or newer versions of some software, like Apache Tomcat 10 (or higher).
To build your content handler for Jakarta, use the jakarta branch of this repository. It updates FileContentHandler's imports and the dependencies in pom.xml to use the Jakarta equivalents.
To install your new content handler, maven will output a JAR with the required additional dependencies to the target/deploy directory. If you are using VirtualViewer on Docker, copy all these files to the classes directory and update the web.xml to use your content handler. See the VirtualViewer Docker documentation for more information. If you are using a virtualviewer.war file, extract the WAR file, install the contenyd of deploy output to virtualviewer/WEB-INF/lib/ and update the contentHandlerClass in web.xml file in virtualviewer/WEB-INF (see below).
In web.xml, change the contentHandlerClass value to the name of your new content handler. In this example, we will use com.snowbound.virtualviewer.contenthandler.example.FileContentHandler