The CacheValidator interface defines a method that will be called when a document is requested that is in the cache to determine whether or not the cache may be used to retrieve the document, or the normal content handler sequence must be called.

The document cache speeds up access to documents by saving the rendering the first time a document is viewed. When it is viewed for the second time, the rendering can be fetched from the document cache and re-used.

When multiple users are viewing documents, documents that should be secured may end up in the document cache. To prevent a user that does not have permission from viewing a high security document, use the cache validator to check the user’s permission before allowing a document to be fetched from the cache for that user.

The cache validator can also be used to prevent high security documents from being stored in the cache.

To use this feature, your custom content handler must implement com.snowbound.contenthandler.interfaces.CacheValidator in addition to VirtualViewerContentHandlerInterface.

Cachevalidator method detail

validateCache: Determines whether or not the specified cache put or get is allowed.

public ContentHandlerResult validateCache (ContentHandlerInput input)
throws
com.snowbound.contenthandler.VirtualViewerAPIException

PARAMETERS

A ContentHandlerInput object containing the following data:

Key Type Description
KEY_CLIENT_ INSTANCE_ID String Value of the clientInstanceId parameter.
“KEY_DOCUMENT_ID” String The name or ID of the document.
“KEY_ANNOTATION_ID”   Either ContentHandlerInput.VALUE_CACHE_GET or ContentHandlerInput.VALUE_CACHE_ PUT.

RETURNS

A ContentHandlerResult object with the following key/value pairs: ContentHandlerResult.KEY_USE_OF_CACHE_ALLOWED either Boolean.FALSE or Boolean.TRUE.