Interface CacheValidator

  • All Known Implementing Classes:
    FileContentHandler, RestfulHttpContentHandler

    public interface CacheValidator
    Allows VirtualViewer to confirm whether specific documents should be retrieved or stored in the VirtualViewer cache. By default, all documents may be stored and retrieved, allowing for a smoother and faster user experience.
    • Method Detail

      • validateCache

        ContentHandlerResult validateCache​(ContentHandlerInput input)

        This method is called before each document is stored in or retrieved from the VirtualViewer document cache and can confirm the operation or prevent it on a document-by-document basis.

        The response for each document and operation is cached for a short time in VirtualViewer to prevent asking about the same operation multiple times in quick succession. In other words, if a specific document is prevented from being cached, VirtualViewer will not ask again for a few minutes and the document will remain uncached for that time.

        Parameters:
        input - ContentHandlerInput containing the following values:
        Every row is an expected value in the ContentHandlerInput. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_CACHE_ACTION ContentHandlerInput.VALUE_CACHE_GET or ContentHandlerInput.VALUE_CACHE_PUT The action to be confirmed for the specified document. GET asks whether the document should be retrieved from the cache, while PUT asks if it should be stored.
        KEY_DOCUMENT_ID java.lang.String The key representing the document. Can be retrieved with String documentId = input.getDocumentId(); .
        KEY_CLIENT_INSTANCE_ID java.lang.String Custom configurable value used to pass data from client to content handler. If not set then will be the session ID. Can be retrieved with String clientInstanceId = input.getClientInstanceId();
        KEY_HTTP_SERVLET_REQUEST javax.servlet.http.HttpServletRequest Request that called this method. Can be retrieved with HttpServletRequest request = input.getHttpServletRequest();
        Returns:
        ContentHandlerResult with the following values:
        Every row is an expected value in the ContentHandlerResult. The first column is the string key for the value. The second column is the type of the value. The third column is the detailed description of the value.
        KeyTypeDescription
        KEY_USE_OF_CACHE_ALLOWED boolean true to allow the operation to continue and false to prevent it. This response will be remembered for a few minutes.