Yes, that's what I'm trying to do.

I can't figure out how to turn my file name in the file system, 
c:/GuestbookServlet/work/guestbook/EMCDL43828.zip, into an http:// URL.

I assume that I need to look at something like the context path and/or my web.xml file 
to determine the exact value of my URL. I can't figure out how to get the leading part 
of the URL, i.e. the part after http:// and before the file name EMCDL43828.zip. 

Can you tell me what I need to do?


>>> [EMAIL PROTECTED] 07/24/02 04:28PM >>>
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 

___________________________________________________________________________
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