tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chiuming <chiu0...@yahoo.com>
Subject file download servlet
Date Tue, 11 Sep 2001 21:52:36 GMT

I asked this question before, but I didn't get any
reply. I post it again in hope someone could give me
some hint.

I have a file download servlet serves web browsers.

request to file is like this
http://192.168.1.105/download/servlet/download?filename=song.mp3
 
The file on the server side is song.mp3.  But the file
got download to
browser is the servlet name instead.  :(

I heard i need to use the HTTP header
res.setHeader("Content-Disposition","attachment;
filename=\"" +
downloadFile + "\";"); 

Is Content-Disposition a standard header in HTTP spec?
 I heard i should use this whenever I don't want the
content display on browser (force Save as Dialog box)

Why everytime I download a file from the web server
like song.mp3.
there is no such HTTP header from web server? -->
Content-Disposition  

I think web server is just like a download servlet. It
sends raw bytes to web browser. After browser get the
bytes, It will not konw what name the file should save
as.  Web server must send some kind of HTTP header to
tell web browser what file name the file is saved as.
right?

How exactly is web server instruct web browser to pop
up Save as Dialog box (on unknown mime type) and save
the file with name = filename on server?  Does web
server use any special HTTP Header (like
Content-Disposition)


thanks.

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

Mime
View raw message