1

I am working on a file sharing web application. This application is being developed using jsp and servlet, MySql, Apache tomcat 6.0 webserver and Eclipse Juno IDE. My expert level is beginner for these given technologies. This application is a file sharing and trading application, where uploaded files will be shown to the user in browser.

The types of files which will get uploaded will mostly pdf, image files like jpg, jpeg, tiff, word, excel, powerpoint etc.

This application have a file upload utility. Under this utility user enters some basic information regarding file in a HTML form and gives path to file on local machine using browse button. When User clicks on Submit button the data in form is saved in database and the file gets uploaded on server on a certain common location specified by application.

I have following questions and doubts regarding which I want guidance and solution from experts.

1) Currently I store the uploaded file on different location on same web server rather than storing it in web application folder to avoid issues related to re-deployment of web application or up-gradation of server. But the problem is, as I wish to make available the above mentioned file to user in the browser in some sort of document viewer like scribed or google doc viewer etc. For this I thought of using google document viewer service which I can use in the following way

 <iframe src="http://docs.google.com/gview?url=http://www.xyz.com/pqr.pdf&embedded=true"> style="width:100%; height:600px;"></iframe>

But in above example as far as I know the pdf file mentioned in url should be inside of web application folder. In my case my files are stored on a fix location but outside of web application folder. So I want to ask to experts that Is there any way to access the file situated outside of the web application folder on same webserver with domain name of web application? How to achieve this and use it in above example?

My aim behind using multi document viewer like the one that is mentioned above is that I want to remove the dependancy of my application on local machine applications and plugin.

Please guide me in these issues friends!

Thanks You!

Param-Ganak
  • 5,787
  • 17
  • 50
  • 62
  • I would suggest splitting this in tree separate questions, because it is difficult to answer this way. – jeroen_de_schutter Nov 29 '13 at 08:54
  • @jeroen_de_schutter Hello sir! I have splitted the question the seconde question url is http://stackoverflow.com/questions/20283205/how-to-use-google-document-viewer-offline-or-is-there-any-api-which-i-can-use-of – Param-Ganak Nov 29 '13 at 10:15
  • You need to create a servlet to stream the file to the client. – Uooo Nov 29 '13 at 10:21
  • @Uooo Thank you sir for your reply But I dont understand what exactly you want to say? Please explain in detail. An example or a demo code or a reference link is welcome – Param-Ganak Nov 29 '13 at 10:38
  • @Uooo My question is I want to access the file which is situated outside of my web application directory like other files which are in web application directory using domain name followed by rest of the url. I dont want to download it. – Param-Ganak Nov 29 '13 at 12:32
  • Accessing files via http == downloading files ;-) – jeroen_de_schutter Nov 29 '13 at 12:57

1 Answers1

1

"But in above example as far as I know the pdf file mentioned in url should be inside of web application folder."

No, that's not true. It can be anywhere, as long as it's downloadable by the document viewer web application, and as long as the document viewer web application accepts external URLs. If it doesn't accept external URLs, you will need to upload the files to the document viewer web application first.

Robin Green
  • 32,079
  • 16
  • 104
  • 187