Documents getting downloaded in tmp folder multiple times

Hi,


In the servlet version of GroupDocs for the below code, we are seeing the same file is generated with diffferent names in different folders.

In ViewDocument.java

public static final String STORAGE_PATH = “/tmp”;//getProjectBaseDir().resolve(“src/main/webapp/storage”).toString();
public static final String TEMP_PATH = “/tmp”;//System.getProperty(“java.io.tmpdir”);


docInfo = ViewerUtils.getViewerHtmlHandler().getDocumentInfo(asset.getOriginal().getStream());
doctype=docInfo.getName();
LOG.error(“Check2 documentType==”+docInfo.getDocumentType()+“docinfo” +docInfo.getName());


We are using the below showcase project

<a rel=“nofollow” href=“https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java/tree/master/Showcase/GroupDocs.Viewer-for-Java-using-Servlets” class=“js-navigation-open” id=“2c2ba3fb83b5122f222476c431aba030-9cb6d109943dfd9f1b869a0784e20f05f3d36923” title=“GroupDocs.Viewer-for-Java-using-Servlets” style=“transition: all 0.3s ease 0s; color: rgb(64, 120, 192); text-decoration: none; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Helvetica, Arial, sans-serif, “Apple Color Emoji”, “Segoe UI Emoji”, “Segoe UI Symbol”; font-size: 14px; line-height: 20px; white-space: nowrap;”>GroupDocs.Viewer-for-Java-using-Servlets

and version 3.2 of API

Hi Ram,


Thanks for posting your query.
we are seeing the same file is generated with diffferent names in different folders.
Can you please elaborate this and provide us some screenshots? Are you seeing cached files at different places with different names regardless of the fact that you restrictively set some temporary folder path?
If yes, then we are able to reproduce this issue at our end using GroupDocs.Viewer for Java 3.2.2 version of the API. However, this issue is not reproduced using latest version of the API that is 3.7.0. Please integrate latest version of the API in project and share your feedback.
We’ll appreciate your coorporation.

Have a nice weekend ahead.
Best wishes
Hey Atir,

It seems everytime I try to call ViewHtmlHandler,ViewImage handler, a new file is created in case if the file name is not specified as a parameter. Since we don't have the file in the local folder we are passing input stream to create the file.
Initially there were lot of files that were getting generated and after adding the filename as a parameter, there is a reduction in the number of folders that are getting created. I will add the zip file that contains the folders that are getting created. I am also not sure why a file is being created with _pdf in the filename. Shouldn't the filename be .pdf
com.merckgroup.aem.healthcare.doucment.groupdocs.servlets.ViewDocument fileName==>GeoPyramid_Datasheet.pdf
At this point, I am unable to go beyond the for loop which maybe the reason why the style tag is not getting generated for the html file. Refer the screenshot. I don't see the style tag in the code.

LOG.error("Log3==");
List test = page.getHtmlResources();
LOG.error("page.getHtmlResources()==>"+page.getHtmlResources());
for (HtmlResource resource : page.getHtmlResources()) {
LOG.error("resource.getResourceType()"+resource.getResourceType());

Refer the below code that I used to get the html pages which led to multiple folder creation. I have also added log output.

htmlPages = ViewerUtils.getViewerHtmlHandler().getPages(asset.getOriginal().getStream(),fileName,htmlOptions);
LOG.error("htmlPages==="+htmlPages);
LOG.error("htmlPages1==="+ViewerUtils.getViewerHtmlHandler().getPages(asset.getOriginal().getStream()));
LOG.error("htmlPages2==="+ViewerUtils.getViewerHtmlHandler().getPages(asset.getOriginal().getStream(),htmlOptions));
20.01.2017 10:40:43.461 *ERROR* [0:0:0:0:0:0:0:1 [1484926838165] POST /services/ViewDocument HTTP/1.1] com.merckgroup.aem.healthcare.doucment.groupdocs.servlets.ViewDocument doctype==GeoPyramid_Datasheet.pdf
20.01.2017 10:40:43.573 *ERROR* [0:0:0:0:0:0:0:1 [1484926838165] POST /services/ViewDocument HTTP/1.1] com.merckgroup.aem.healthcare.doucment.groupdocs.servlets.ViewDocument htmlPages===com.groupdocs.viewer.internal.c.a.ms.a.a.a.n@6f5e7798
20.01.2017 10:40:50.544 *ERROR* [0:0:0:0:0:0:0:1 [1484926838165] POST /services/ViewDocument HTTP/1.1] com.merckgroup.aem.healthcare.doucment.groupdocs.servlets.ViewDocument htmlPages1===com.groupdocs.viewer.internal.c.a.ms.a.a.a.n@3a911c67
20.01.2017 10:40:52.026 *ERROR* [0:0:0:0:0:0:0:1 [1484926838165] POST /services/ViewDocument HTTP/1.1] com.merckgroup.aem.healthcare.doucment.groupdocs.servlets.ViewDocument htmlPages2===com.groupdocs.viewer.internal.c.a.ms.a.a.a.n@10066e88


Storage and Temp folder defined in ViewerUtils:
public static final String STORAGE_PATH = "/tmp1";//getProjectBaseDir().resolve("src/main/webapp/storage").toString();
// public static final String TEMP_PATH = "/tmp";//System.getProperty("java.io.tmpdir");
public static final String TEMP_PATH = System.getProperty("java.io.tmpdir");

Regards
Chetan Mahendru

Hi Chetan,


Thanks for sharing the details.
We reproduced same issue at our end using 3.2.2 version of the API. However, if you integrate latest version of the API that is 3.7.0, you will not face this issue.
Please integrate the latest version of the API and share your feedback.

Have a nice weekend ahead.
Best wishes

I am actually using 3.7 version of the API. Is there a specific file that I need to update. I am using the code present in servlet showcase example.

It seems it is unable to get the html resource for the page. I got size 0 for the below lines


List test = page.getHtmlResources();
LOG.error(“page.getHtmlResources() size==>”+page.getHtmlResources().size());
for (HtmlResource resource : page.getHtmlResources())

Hi Chetan,


we are seeing the same file is generated with diffferent names in different folders
This issue was reported earlier by Ram using GroupDocs.Viewer for Java 3.2.2 version. And we cannot reproduce same issue at our end using latest version of the API that is 3.7.0. Hence, we recommended to integrate latest version of the API in your project.
It seems it is unable to get the html resource for the page. I got size 0 for the below lines
Talking about this, is it a new issue you are facing or is it associated with the issue discussed earlier?
We would encourage you to post new issue in a new thread, so that we can investigate it independent of any other scenario.
We’ll appreciate your cooperation.

Have a nice weekend.
Kind regards

well its the same issue that I am working on i.e. to fix the issue related to styles. We haven’t used HTML viewer till now and since the image viewer wasn’t working on IE, we had to move to HTML viewer. So this can be treated as a similar issue. Multiple folder issue has been resolved. I updated the code to provide file name as a parameter every time I called ViewHtmlhandler/ViewImageHandler.

Now I need to understand why we are getting 0 even though the HTML content is present.

Hi Chetan,


Now I need to understand why we are getting 0 even though the HTML content is present.
Please confirm us that you are facing this issue using 3.7.0 version of the API, right?

Thanks

Hi There,


We reproduced this issue at our end if we set embed resources to false. Please make sure that this is the same case at your end and let us know.

Many thanks