dcsimg
Serving file which is not in web application path from servlet
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Srividya_M
Posted On:   Friday, November 2, 2001 02:23 AM

I want to serve a pdf file from a servlet.
But the problem is the file is not part of the web application folder
but resides in another folder.

please help.

Re: Serving file which is not in web application path from servlet

Posted By:   Alex_Chaffee  
Posted On:   Friday, November 2, 2001 07:47 AM

See How do I download a (binary, text, executable) file...


There are three directory trees you need to worry about:


  1. webapp

  2. webapp/WEB-INF

  3. the rest of your file system


To download a file from within the webapp, you can use plain old HTTP.


To download a file from anywhere else -- including the webapp/WEB-INF under WEB-INF -- you need to call a servlet that opens the file and spits out the contents as described above.

Note that the user your servlet engine is running as must have permission to access that file, or you will get a server error.

Re: Serving file which is not in web application path from servlet

Posted By:   Luigi_Viggiano  
Posted On:   Friday, November 2, 2001 02:30 AM

Which is the problem? use an href to reference it, or a sendRedirect to send the browser to it.
About | Sitemap | Contact