Free Support Forum - groupdocs.com

Reg ViewerHandler.getViewerScript issue i.e. Upload working fine but View not working in spring Sample Demo


#1
Hi
I am unable to get the viewerscript from this call viewerHandler.getViewerScript(viewerId, initialFilePath, locale)

I have given the property in application.properties
groupdocs.viewer.filePath=C:/Projects/GroupDocs/Apps/xFiles/

I am using Spring sample demo
After i have uploaded the image to some path provided in properties file

when i upload file its getting uploaded into C:/Projects/GroupDocs/Apps/xFiles/null and getting the token id.

but when viewing with this token id, this view flow not showing any document and encoded path is showing e or g kind of encoded value and
viewHandler.getViewerScript not giving any result


Please let me know why view is not working in the Spring Sample Demo, please let me know if any properties need to set

#2
Hello Vigay,

Thank you for your inquiry.

Please try to set the "applicationPath" parameter as "/" for the application.properties file, then the upload should work well. Also you can configure the "uploadPath" parameter and then you will upload your files to this local url "C:/Projects/GroupDocs/Apps/xFiles/uploadPath".

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

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

Hi Evgen,


I am not facing problem with Upload, i am able to upload the file.
With this upload getting tokenid, and this tokenid is being passed to VIEW to view the file in groupdocs viewer.

But here the issue i am facing is to view the file in groupdocs viewer.
I am unable to see any response w.r.t groupdocs viewer in the index page.

Though the proper token id is being passed in the sample spring demo example, i am unable to view the file…
Could you please let me what is the problem.

Below are my application.properties file

groupdocs.viewer.applicationPath=/
groupdocs.viewer.filePath=C:/Projects/GroupDocs/Apps/xFiles
groupdocs.viewer.uploadPath=uploadPath

Thanks & Regards
Vijay

#4
Hello Vijay,

We are sorry that you have such issue. We have reproduced it and this issue will be resolved in our next release of the GroupDocs.Viewer for Java , that should be tomorrow or after tomorrow.

Sorry for the inconvenience.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#5

Oh Thanks Evgen,


But could you please let me know other alternatives i can work around to make sure groupdocs viewer is showing the file in the index page for the file i have uploaded.

Thanks & Regards
Vijay

#6
Hello Vijay,

We have attached to this thread our Spring sample with our test file . Could you please check it , also please check our video how it works for us here .

If you still get the issue with your file please share it for us.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#7

Thanks Evgen,


But in my environment still the same issue, even i have used the sample spring demo application you have shared with me.

Still i am facing the same issue i.e. i am able to upload the document but unable to view the document though token id is passing to the view mapping.

After uploading this is what the screen I am getting,
whereas file is uploaded actually.

<o:p></o:p>

But view is working not showing anything. This is what the issue I am facing.

View URL is below like this: with uploaded token id but still nothing is showing in the page.

http://localhost:8080/groupdocs-viewer-spring/view?tokenId=v9/pDoBRCD7oqodejrbYClj9L9Qq5EgeOltg/7wRZ8vmFU4OFY/HPzBPqC9seXAweQ/YQk3VI/7UkakktHVAiETCx8c3LzMDQ6wmjYf5nBI=

I am unable to attach my screenshot here.


Thanks & Regards

Vijay



#8
Hello Vijay,

Thank you for your details.

Could you please specify, why in your URL you use "groupdocs-viewer-spring" name, do you made any changes in the pom file in our samples or in the code? If yes, then please share with us this changes, because our sample should be stored on this URL "http://localhost:8080/view?tokenId=v9/pDoBRCD7oqodejrbYClj9L9Qq5EgeOltg/7wRZ8vmFU4OFY/HPzBPqC9seXAweQ/YQk3VI/7UkakktHVAiETCx8c3LzMDQ6wmjYf5nBI=".

Please share with us your environment (Java and TomKat version) and how do you tried to run our sample. Also will be useful if you share with us a screenshot of logs from browser console. You can share this screenshot via Google Drive, DropBox or some other cloud service.

Come back to us with these details and we will be glad to help you.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#9

Hi Evgen,


I am using Eclipse for this, Below are the steps did for the same.

1) Imported the provided sample spring demo application as Exsiting maven project into eclipse
2) configured apache tomcat 7 in eclipse
3) did mvn clean install for the spring demo and added the project to tomcat7
4) ran tomcat 7 and the application is up
5) able to do the upload of the file in the location provided in application.properties.
6) But not getting succesful in viewing the uploaded file in groupdocs viewer.


Below are the few points i would like to know regarding the ViewerHandler and EncodedPath Classes in the process of viewing the file in groupdocsviewer.

1) Since EncodedPath(filepath, serviceconfiguration) expects the filepath parameter, how do i know the filepath of the already uploaded file.
Do we have any class which gives the file path by providing the fileName?
Is it fine if i use CustomInputHandler to upload the file and get the filePath while viewing.

2) in case of ViewerHandler class’s getViewerScript(viewerId, initialFilepath, locale), what need to be passed for viewerId.
can we pass any if not how do we set this viewerId before we pass to this method.

Thanks & Regards
Vijay



#10
Hello Vijay,

We have released new version of the GroupDosc.Viewer for Java. You can download our demo samples for this version from here.

About your questions:

1) Yes you can use the CustomInputDataHandler for get the file path, also you can get file path with such code:

String filePath = applicationConfig.getUploadPath() + fileName;
String path = new EncodedPath(filePath, viewerHandler.getConfiguration());

2) the viewerId parameter it is a simple id for DIV tag where will be Viewer put . Please check index.jsp file and you will find there this code .

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#11
Hi Evgen,

Still not able see the document in the groupdocs viewer.
I am able to see the groupdocs viewer contianer in the index page but not the document.
Below is the log message i am getting while i am viewing the document after it got uploaded.


Jul 16, 2015 12:10:33 PM org.springframework.web.servlet.DispatcherServlet noHan
dlerFound
WARNING: No mapping found for HTTP request with URI [/viewViewDocumentHandler] i
n DispatcherServlet with name 'dispatcherServlet'
Jul 16, 2015 12:10:33 PM org.springframework.web.servlet.DispatcherServlet noHan
dlerFound
WARNING: No mapping found for HTTP request with URI [/viewLoadFileBrowserTreeDat
aHandler] in DispatcherServlet with name 'dispatcherServlet'


Thanks & Regards
Vijay

#12

Hi Evgen,


Now i am able to view the document through groupdocs viewer in spring 2.12.0 samples demo.
But it is not working in my environment as it when i downloaded the demo.
I need to add the below things in mvc-config.xml along with the application.properties file changes as below

mvc-config.xml
============
context:annotation-config/
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/viewer/" />

application.properties
================
groupdocs.viewer.applicationPath=/
groupdocs.viewer.filePath=C:/Projects/GroupDocs/Apps/xFiles/
groupdocs.viewer.uploadPath=upLoad


But this is plain demo if i execute using run.bat command provided.


Issue with Eclipse
=============
But when i import this as existing maven project into Eclipse, this is not working.
=====================================================
In Eclipse i am getting the below error if i keep
<spa:property-placeholder-annotations location=“classpath:application.properties” /> in mvc-config.xml

error is below

Referenced file contains errors (http://code.google.com/p/spring-property-annotations/spring-property-annotations-1.0.xsd). For more information, right click on the message in the
Problems View and select "Show Details…"


to avoid this error, i replaced
<spa:property-placeholder-annotations location=“classpath:application.properties” />

with

<bean
class=“com.urbanmania.spring.beans.factory.config.annotations.PropertyAnnotationAndPlaceholderConfigurer”>
classpath:application.properties


With this no error, but still i am unable to view the document using groupdocs viewer. Not sure why this is happening.

Could you please let me know if some thing is to be taken care.

Thanks & Regards
Vijay

#13
Hello Vijay,

We think that you have this issue because you have misconfigured project deployment. If we understand you correct, you got the document-viewer.war after command "mvn clean instal", then you tried to run it on TomCat7 and you hasn't changed the pom.xml file. But our sample is configured to deploy with this context "/" and you should rename your .war file to ROOT.war and then run it on TomCat.

Or you can change the configuration of the sample deploying in the pom.xml file for example:
org.apache.tomcat.maven
tomcat7-maven-plugin
2.0
document-viewer/

and then change applicationPath parameter in the application.properties file :

groupdocs.viewer.applicationPath=http://localhost:8080/document-viewer/

These changes should help you.

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

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+