The VirtualViewer HTML5 for Java Content Handler is a Java class that the servlet will call on to perform various actions concerning the retrieval and storage of content.

VirtualViewer HTML5 for Java comes with a sample file content handler that connects VirtualViewer HTML5 for Java to your file system. The sample content handler that connects to the server’s File System is provided as a starting point to integrate VirtualViewer HTML5 for Java with your document storage.

By default, the VirtualViewer HTML5 for Java servlet will use the sample content handler that VirtualViewer Software provides. reads and writes to a file system location. You can find this sample content handler at virtualviewer\Sample-Code\Java Content Handler. It displays files from the /sample-documents directory.

The sample content handler is not intended for production use. We encourage you to use this as a starting point for writing your own custom content handler to integrate VirtualViewer HTML5 for Java into back-end systems. You should create your own content handler to serve up documents from locations that work for your company as well as to add error handling and more robustness for handling requests from multiple users.

How the Content Handler Works

Whenever VirtualViewer HTML5 for Java requests a document, the servlet will first check the cache to see if the document is present. If it is not, it then calls into the content handler for the document. The order of action is as follows:

  1. getDocumentContent
  2. getAnnotationNames
  3. getAnnotationContent (once for each layer name returned by getAnnotationNames)
  4. getBookmarkContent

Whenever the user chooses to save the document by choosing Save Document, VirtualViewer HTML5 for Java passes the appropriate data to the servlet, which calls the content handler method saveDocumentComponents.

Inside saveDocumentComponents the following methods should be called separately when the appropriate data has changed:

  • saveDocumentContent
  • saveAnnotationContent
  • saveBookmarkContent

Other methods within the content handler are called by various functions in VirtualViewer HTML5 for Java.

For more information about ready-made and custom content handlers, please contact

Content Handler method documentation

For information regarding specific method APIs, please see the Content Handler API documentation.

Additional topics