Question & Answer
What steps are required to deploy the line data HTML5 viewer with Content Manager OnDemand?
Beginning in Content Manager OnDemand server version 10.1.0.3 and enhanced at version 10.1.0.5, a new viewer is provided for viewing line data documents from a web browser when using the Content Manager OnDemand Web Enablement Kit (ODWEK). While Content Manager OnDemand customers can continue to use the Line Data Applet, this new viewer ("the viewer") is HTML5-based. To use the new viewer, you must make some code changes to your servlet environment, and then deploy the new viewer.
The new viewer is launched by redirecting the servlet request to open a document. When your servlet receives a request to open a line data document, it must forward this request to the Viewer.html file, passing some parameters along with the request. There are four parameters that need to be passed and are as follows:
action - This parameter should be set to the callback servlet you currently use for the Line Data Applet. It is the one that processes the viewerPassthru() call.
docid - This is the encrypted docid for the line data document you are wanting to view. Make sure the value here is encoded. (See URLEncoder class.)
folder - The name of the folder. Special characters in Content Manager OnDemand folder names require that the folder name be URL encoded. (See URLEncoder class.)
language - This is the language of the browser for this request. This can be obtained by reading the Accept-Language header of the request object.
The sample code below shows how your redirect might look:
response.sendRedirect (request.getContextPath() + “LineDataViewer/Viewer.html” +
“?action=” + request.getRequestURI() +
“&docid=” + URLEncoder.encode(docId, “UTF-8”) +
“&folder=” + URLEncoder.encode (odFolder.getName(), "UTF-8") +
“&language=” + request.getHeader(“Accept-Language”));
This will redirect the browser to Viewer.html which, once downloaded, will start the process of retrieving and viewing the specified line data document.
The viewer code itself ships with Content Manager OnDemand and is entirely contained in a zip file named LineDataHTML5Viewer.zip. As you can see in the above code sample, this zip file was extracted to a directory called 'LineDataViewer' at the root level of the web application. Your web paths may vary.
- The line data HTML5 viewer will work with ODWEK version 10.1.0.3 or later, however enhancements were made at version 10.1.0.5, which is the recommended minimum. Make sure to upgrade ODWEK before attempting to enable this new viewer.
- The line data HTML5 viewer is supported on Apple Safari, Google Chrome, Microsoft Edge, and Mozilla Firefox browsers. It is not supported on Microsoft Internet Explorer.
- It is important that your web server be configured to return json files as application/json. If your web server is not configured to return json as application/json, the viewer will not run. A look at your browser debugger console (see your browser documentation) may show the following error(s):
Font: ‘]’ not found
Object doesn’t support property or method ‘splice’.
You can also examine the response headers in the browser (see your browser documentation) to verify the proper mime type is being returned.
15 August 2019