Free Support Forum - groupdocs.com

Groupdocs viewer with Play framework (Non war-deploy-able server)

Hi Team,


Is it possible to get groupdocs viewer working with Play framework?

In details, Play framework is using embedded Netty web server. Netty is not a war deploy-able server. Is there a way I can use groudocs without war deployment?

Any help/tips/references would be greatly appreciated.


Brief summary for requirement: I need to show preview of M.S. office documents in web browser using Play framework.
Thanks,
Prabhjot
Hello Prabhjot,

Thank you for your request.

Yes you can use our library with Play framework, because our library is ordinary .jar library that can be used in Java Web applications. Basically, at the moment we haven't any sample code for using it with Play framework, but you can investigate how it works on our Dropwizard sample. This sample can be run without war file. The sample will show you which handlers you should create for use our library . Also you can use our API documentations, that provided in .zip archive with our library.

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+

Dropwizrd example is limited to my knowledge. Did not get much out it.


So I referred integration with php. For front-end I downloaded many libraries manually from various sources but still missing following.

JS:
  1. GroupdocsViewer.all.min.js
  2. installableViewer.min.js
  3. modernizr.2.6.2.Transform2d.min.js
CSS:
  1. GroupdocsViewer.all.min.css
  2. jquery-ui-1.10.3.dialog.min.css

Could you please guide where can I download these libraries from ?

P.S. It would be nice to have downloaded all libraries used in the example from one place (if possible)

Thanks,
Prabhjot



Hello Prabhjot,

Thank you for coming back.

Basically, all these libraries are included in the GroupDocs.Viewer for Java library and as you can see in the article(integration with php) you should deploy on your server our library (for example our Dropwizard or Spring sample). And then you can use the described approach . You should set only web url of the runned sample for example http://127.0.0.1:8080/ to "url" variable.

Sorry but we not share our .js libraries that included in our stand alone libraries for Java for customers .

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+

Hi, I’m also interested in using your lib with our play framework application, but in the dropwizard sample I see that the ViewerHandler requires a javax.servlet.http.HttpServletRequest to get the different handlers for the UI, and play! doesn’t use that HttpServletRequest. Is it possible to modify the behaviour so that it doesn’t depend on HttpServletRequest ?


Hello,

Thank you for your inquiry.

Yes, you can use our Viewer with out HttpServletRequest in the handlers. To achieve this you should use ViewerHandlerBasic class as described in the documentation which you can find in the library package.

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+

Hi, thank you for your reply, but it’s still not clear to me. As far as I understand, in the dropwizard sample you define multiple http endpoints for the different handlers used in the UI client, for instance getJsHandler uses viewerHandler.getJsHandler to get the appropriate handler, but that method is not implemented in the ViewerHandlerBasic class. ¿What are the necessary handlers that we need to implement?.

Hi, I’ve been trying to integrate the library with our play! project with no success so far. My approach was to use the ViewerHandlerBasic as sugested for implementing the neccessary http endpoints in play! without depending on servlets.


If we set groupdocs.viewer.useHtmlBasedEngine=false it seems that the only required handlers are ViewDocumentHandler, GetImageUrlsHandler and GetDocumentPageImageHandler (besides the js and css handlers that are required to get the UI client code). I thought those handlers could be implemented in terms of the ViewerHandlerBasic, because it has corresponding methods: viewDocument, getImageUrls and getDocumentPageImageHandler, and these would produce the same response as required without requiring servlet objects. I’ve managed to implement ViewDocumentHandler and GetImageUrlsHandler correctly, but I get a weird error when using the method getDocumentPageImageHandler. The documentation says that imageUrl parameter is the “image url from viewDocuemnt response image urls list”, but even though I pass the exaclty same url as returned for the viewDocumentResponse I get a java.lang.ArrayIndexOutOfBoundsException: 1. I don’t see any mistake in the string I’m passing.

So I’m stuck there, and even if that would work the remaining problem would be how to serve the necessary js and css for the client to work without relying on the ViewerHandler class. Can we get the client-side JavaScript manually by looking through the HTML code of the rendered page as suggested in the php integration page or does it change with the file or every time we restart the server?

I appreciate any help on this.
Hello,

Basically, you are right, that the getJsHandler and getHeader instances will be use only for the ViewerHandler class, because these instances will get the scripts and html for UI .The ViewerHandlerBasic class was implemented for desktop applications and this content doesn't required for the application. But you can do next:

1. use the ViewerHandlerBasic class
2. add to your application the sources of js scripts and html and then call them from the application.

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+

Hello, thanks for your help.


When you say: “2. add to your application the sources of js scripts and html and then call them from the application.” you mean getting the sources from the rendered page ?

Also, can you help me with the error I get when calling ViewerHandlerBasic.getDocumentPageImageHandler ? I’m passing to this method a String like: path=h&pageIndex=0&width=100&quality=85&usePdf=false&watermarkPosition=&watermarkFontSize=0&useHtmlBasedEngine=false&rotate=false&isPrint=false
and I get a stack trace error like the one attached to this message, I’m using servlets there but with the ViewerHandlerBasic class. I think that would be only missing thing to integrate your library in our project, I appreciate any help with this one.

Hello ,

Thank you for coming back.

I mean , that you can get the sources of the js scripts, css and html from the .jar file of the library and then add them to your project . Or you can add the static content to the web page as as described in this article (section UI. Static Integration ).

About your issue with the ViewerHandlerBasic.getDocumentPageImageHandler method , could you please share with us your code of implementation that we can investigate the issue reason .

We will wait for your code example.

-------

Best regards,
Evgen Efimov

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

Hello, basically I’m using the java web sample changing to use ViewerHandlerBasic. You can find the working project here. The error happens in the GetDocumentPageImageHandlerServlet class, if I uncomment line 33 and comment 36-38 the application works correctly with the other changes.


Thank you again for your help.
Hello,

We have managed to reproduce your issue on our side. At the moment our Product team works on new generation of the GroupDocs.Viewer for Java product and this issue should be resolved in it. Please stay tuned with our newsletters .

Sorry for the inconvenience.

--------

Best regards,
Evgen Efimov

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

Hello, ok good. Thank you very much.

Hello,


You are welcome.

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+

Hello, it’s been a while since my last inquiry about this. I wonder if it’s already fixed in the new version before I jump into trying again, we already acquired the license for all the Java libraries but using the servlet implementation and right now we’re facing a situation where we can’t use servlets for the viewer but we need to integrate it directly in our play framework project.


I appreciate any information.

David.
Hello,

Basically, our new generation of the GroupDocs.Viewer for Java is absolutely different - it's totally rebuilded from scratch and has nothing with the legacy version. So you should migrate to the new generation of the library. Please investigate this documentation for how to's.

If you will have more questions about the migration, then please create a new forum thread and specify a version of the Viewer library.

-----------

Best regards,
Evgen Efimov

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