Link to home
Start Free TrialLog in
Avatar of bhomass

asked on

servlet download file

I am using servlet to down load different kind of files, some text, some binary. I use BufferedInputStream to read in the file content and use response.getOutputStream(  ) to write out.

I tried setting content type to "text/plain" for a text file, but FF browser simply opens it up, whereas I want to get it to activate the download dialog.

I then tried content type "application/octet-stream", I get a error message, something about
some strange filename with .lnk can not be saved, because an unknown error occurred. Try save to a different location.

is it obvious what I did wrong?

Avatar of Jathrek

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bhomass


nice. the example I followed was just incomplete. I found references for the things you included, and the code worked!