Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serve an off-site page

 
Michael Mendelson
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic