Free Support Forum - groupdocs.com

Use InputDataHandler to manage FileDescription when consume through URL to FILE


#1


InputDataHandler could be used to manage FileDescription to files under root folder.

If it still works while using URL to File ?

When using URL to File to render the document view , could it possible to use the same mechanism to manage FileDescription , like GUID , file size ,etc. ?

#2
Hello Raymond,

Yes, the InputDataHandler can be used to handle files from URL. Actually, when you choose to use custom InputDataHandler then your implementation will handle everything provided by the ViewerHandler.

In particular, what is provided to the
public String getViewerScript(String viewerId, String filePath, String locale)
as filePath is later passed to the getFileDescription and getFile methods of the InputDataHandler as the guid.

So, if you make a custom implementation of the InputDataHandler you can just encode the URL before passing it to the getViewerScript and then decode it in the InputDataHandler, stream from the URL and get all needed data.

Or you can use the default InputDataHandler and encode URLs with com.groupdocs.viewer.domain.path.EncodedPath as it is in our code samples which are provided with the library.
GroupDocsPath path = new EncodedPath(file, viewerHandler.getConfiguration());

The default InputDataHandler is clever enough to differentiate simple file name and URL address and handle it appropriately.