Abhijit,
If the files are all text/html files, you can use a JSP to serve up the
files.  If you are serving up binary files (ie. images, PDF files, etc.)
then you will have to use a servlet.  The reason is that JSP pages are only
supposed to output text.  That being said, all you have to do is to supply
a file name as a query parameter to the servlet or jsp.  The servlet/jsp
will then use the query parameter to read the file from either a directory
under the Web-inf directory of the web app or another location that is read
from a property file.  The location must not be a public area under the web
server root.  When returning the file contents, you should set the content
type of the response to the appropriate file type.

-Richard

At 07:02 PM 9/1/01 +1000, you wrote:
>Hi All,
>This question was asked in a ColdFusion User Group.
>
>I'm wondering if there's an equivalent way(to <CFCONTENT> in CF5) of
>restricting a files location using JSPs?
>
>Ie. When a user tries to download a file she/he should not be able to
>access a file directly using it's URL, rather her/his only method of
>accessing this file should be via a JSP page that serves the file.
>
>Hope my question isn't too ambiguous. Thanks in advance.
>
>Abhijit.
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]] On Behalf Of Ryan Sabir
>Sent: Friday, August 31, 2001 1:45 PM
>To: CFAussie Mailing List
>Subject: [cfaussie] RE: Restricted download period
>
>Instead of pointing directly to the file, you could use <CFCONTENT> to
>serve the file to the user, that way you could programmatically block
>them from getting the file again after a period of time. The files could
>even be stored in a non web accessible directory.
>
>Never tried it, sounds like it would work...
>
>seeya!
>
>
>-----------------------
>Ryan Sabir
>Newgency Pty Ltd
>2a Broughton St
>Paddington 2021
>Sydney, Australia
>Ph (02) 9331 2133
>Fax (02) 9331 5199
>Mobile: 0411 512 454 http://www.newgency.com/index.cfm?referer=rysig
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Brian
> > Brushwood
> > Sent: Friday, 31 August 2001 1:44 PM
> > To: CFAussie Mailing List
> > Subject: [cfaussie] Restricted download period
> >
> >
> > Does anyone know of a way to restrict the download of files from a web
>
> > or ftp server after a certain period? ie a client is only allowed 24
> > hours to download a file. However, i need the file url to be
> > restricted in some way as well, so that they cant just bookmark the
> > file once they have gained access. Any ideas?
> >
> > b
> >
> >
> > ---
> > You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
> > unsubscribe send a blank email to
> > [EMAIL PROTECTED]
> >
> > For a cool news style interface try:
> >    news://lists.daemon.com.au/cfaussie
> >
> >
>
>
>---
>You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
>unsubscribe send a blank email to
>[EMAIL PROTECTED]
>
>For a cool news style interface try:
>    news://lists.daemon.com.au/cfaussie
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to