Since your servlet can see that file, you can use a scheme such as:

request on:
http://host/servlet/YourServlet

outputs something like this:
    <a
href="servlet/YourServlet?action=getFile&filename=thefilename">thefilename</
a>

And when the user click on that link,  your servlet will get the parameter
action and filename, so you can
go ahead and use the outputStream of the resoponse to send the file back to
the user.

Hope this helps




----- Original Message -----
From: "Henry Reardon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 2:08 PM
Subject: Easy (?) Servlet Question


> I think this should be easy to answer. I've spent HOURS looking in books
and online for this but I can't find it; maybe someone here can help....
>
> I have successfully created a temporary file in the servlet temporary
directory. (In my case, the temporary directory is
c:/GuestbookServlet/work/guestbook and the temporary file is
EMCDL43828.zip.) I can see and open this file in the file system via Windows
Explorer, no problem.
>
> I want to create a very simple HTML download page that includes a link to
that file. Can anyone tell me how to convert the system file path into a URL
for the purposes of my download page? I've played with contextPath(),
servletPath(), and other methods but none of them get me the path to the
temporary directory as an http:// URL....
>
> Rhino
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to