aspose file tools*
The moose likes Servlets and the fly likes Serve an off-site page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Serve an off-site page " Watch "Serve an off-site page " New topic
Author

Serve an off-site page

Michael Mendelson
Ranch Hand

Joined: Dec 19, 2000
Posts: 73

Hi, all!
I would like to provide access to a page (a PDF document, actually) that located in a directory not accessible by Tomcat.
I imagine there is some way to set up a servlet to grab the contents of the file, and send it with the proper header.
Does anyone know how to do this offhand, or know of a better way?
(Ultimately my reason for wanting to do it this way is to share files with other apps on the server, AND to implement some access control for the files.)
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
What you want is pretty simple - see any servlets book, including mine. The only things to watch out for are that you have to set the content type and (usually) the content length, and use a binary output stream, not a print writer.
Bill
------------------
author of:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serve an off-site page