How about:
create an jsp that requires a login using a private password file or
database table, have it read the names of the files (using java.io) in the
folder you want them to be able to retrieve, and create links to another jsp
(using a session to maintain your login, and probably the directory to get
the files from as well) that does something like:

  java.io.File f = new java.io.File ("retrievalpath" + fileName);
  response.setContentType("application/octet-stream"); // or the appropriate
mime type if you want to work that out
  response.setHeader("Content-Disposition", "inline;filename=" + fileName +
""); // can also change inline to attachment
  response.setContentLength((int)f.length());
  response.flushBuffer();
  ServletOutputStream thisOut = response.getOutputStream();
  byte[] buf = new byte[1024];
  int numRead = 0;
  while ((numRead = reader.read(buf)) >= 0) {
 thisOut.write(buf, 0, numRead);
  }
  reader.close();
  thisOut.flush();


when you link to the retriever jsp, make sure you have the
fileName=(someFileName) last, and then IE will not try to open a .doc in
explorer instead of the word plugin when you set the disposition to inline.
something like:
getfile.jsp?fileName=some.doc

This allows you greater control over what the user gets to see, and how it
is presented.

Hope this helps.

Sean


Web Solutions That Work Developing custom web solutions designed
specifically to accomplish the unique objectives of our clients. Phone
503-639-2727 Fax 503-639-0807
----- Original Message ----- 
From: "Tom Bednarz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2003 9:45 PM
Subject: HTTP instead of FTP downloads with Tomcat


Hi,

Could anybody please give me some hints how to solve the following problem:

Some of my customers cannot use FTP from their offices due to security
restrictions. I have to offer them the possibility to download files using
the HTTP protocol.

I use TOMCAT but have the listings tag set to false in the default servlet
tag of web.xml to deny directory listings.

The idea is, that I have a virtual directory that points to the customers
directory on the FTP Server and shows its contents in the browser. I think
it should work with a customer specific login. Could anybody please give me
some additional pointers what I exactly have to configure to make this one
working?

Many thanks

Tom



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to