why dont u just copy the file into one of ur context
paths..
or else declare this directory which contains the file as one
of
ur context paths in server.xml.. i am talking about tomcat
configuration.
-anoop
-----Original Message-----
From:
Reinhardt Christiansen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 25,
2002 2:25 AM
To: [EMAIL PROTECTED]
Subject: Re: Easy (?)
Servlet Question
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
- Easy (?) Servlet Question Henry Reardon
- Re: Easy (?) Servlet Question Gang Zhang
- Re: Easy (?) Servlet Question Wil Moore
- Re: Easy (?) Servlet Question Reinhardt Christiansen
- Re: Easy (?) Servlet Question Gang Zhang
- Interesting result of JSP/ASP database ben... Gang Zhang
- Re: Easy (?) Servlet Question Gu, David
- Anoop Kumar V