Defining a custom Content Handler with Maven
By default, PrizmDoc® for Java will use its built-in sample handler. This example contains that code that you can build your handler from. More information is available on the virtualviewer-file-content-handler-example GitHub repo. This example is provided as-is and should not be used in production.
API Documentation
The PrizmDoc® for Java API documentation is located here and here
Supported Versions
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 https://www.accusoft.com/support/.
Requirements
- Java JDK 1.8 or newer
- PrizmDoc® for Java 5.3 and 5.4 require JDK 11
- Apache Maven
- To make development easier, the
mvn
command should be part of your systemPATH
variable. - On most Linux distros, this will be added automatically if you install via the package manager.
- On Windows, add the Maven
bin
directory to your PATH environmental variable.
- To make development easier, the
Building
Before making any modifications, we recommend 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 do not recommend any particular IDE as this is a personal preference.
Installing Your Handler
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 PrizmDoc® for Java on Docker, copy all these files to the classes
directory and update the web.xml
to use your content handler. See the PrizmDoc® for Java 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).
Configure web.xml
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
Have questions, corrections, or concerns about this topic? Please let us know!