Free Support Forum -

Streaming capabilities for groupdocs viewer


Hi Team,

I am doing POC on groupdocs viewer. Below is the code used to generate view script of a document. It working fine.

I have one query here,
We are using
'GroupDocsPath path = new EncodedPath(file,viewerHandler.getConfiguration()) ’ to encode file path. and using GroupDocsPath object further to get view script.
This shows we need to pass file name/path to GroupDocsPath. but we need capability/over loaded method to pass File Stream instead of file name.

Will you provide overloaded constructor for ‘EncodedPath’ class with file steam parameter?

String file = request.getParameter(“file”);

System.out.println(“file :”+file);
String tokenId = request.getParameter(“tokenId”);

GroupDocsPath path = null;
if(file != null && !file.isEmpty()){
path = new EncodedPath(file, viewerHandler.getConfiguration());
}else if(tokenId != null && !tokenId.isEmpty()){
TokenId tki = new TokenId(tokenId, viewerHandler.getConfiguration().getConfig().getEncryptionKey());
path = tki;

String viewerId = “test”;
String initialFilePath = (path == null) ? “” : path.getPath();
System.out.println(“initialFilePath :”+initialFilePath);
String locale = viewerHandler.getLocale();
request.setAttribute(“viewer_head”, viewerHandler.getHeader());
request.setAttribute(“viewerScript”, viewerHandler.getViewerScript(viewerId, initialFilePath, locale));
RequestDispatcher requestDispatcher = request.getRequestDispatcher(“view.jsp”);
requestDispatcher.forward(request, response);


Hello Shiva,

Thank you for your interest in the GroupDocs.Viewer for Java. For providing document as File Stream you should use InputDataHandler interface provided with the library. Basically you will need to implement such methods as getFileDescription and getFile . We have created the documentation for how to use this interface and you can check it here .

If you will have more questions please feel free to contact us.

Best regards
Evgen Efimov
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+