tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Hadianto <>
Subject Writing to response's OutputStream cause problem.
Date Thu, 01 May 2003 09:35:37 GMT
Hi List,

I have a servlet that fetches a file from the server and send this to the 
reponse's output stream. The code looks something like this:


FileInputStream in = new FileInputStream("/tmp/filename");
byte[] buf = new byte[1024];
int length;
while ((length = != -1) {
            response.getOutputStream().write(buf, 0, length);


Now this is working fine, but I have this irritating problem. Say from the web 
browser my user clicks on the link to retrieve the file:


The first thing that the user see is the dialog box saying:

"You are downloading the file:
../ from hostName

Would you save ... "

After this dialog box I got the "real" dialog box that says:

"Downloading file from hostName ..."

I'm puzzled I don't know what went wrong here. Does anyone have a solution for 
this problem?

Many thanks in advance, any help will be much appreciated.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message