473,221 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

dynamic file download from servlet

I need to allow a user of my web application to download
a dynamically generated file, in this case from something
I've stored in a database. I am experimenting with this
and the file to download happens to be a pdf file. When
I hit the link from an IE6 browser it pops up a dialog
box asking whether I want to open or save it, which is
exactly the behavior I want. However, when I press the
open button, Acrobat Reader opens (cool) but then it fails

There was an error opening this document, The file does not exist.

When I click on the same link on my linux box, xpdf handles it
just fine.

I think it has something to do with the HTTP header, but I am
not sure. The following is the code of interest:

AttachmentListItem attachment =
EmailSQL.getAttachmentListItem(connection, 3, 1);
response.setContentType(attachment.getContentType( ));
byte[] data =
EmailSQL.getAttachmentBytes(connection, 3, 1);
"attachment; filename=" + attachment.getFileName());
ServletOutputStream out = response.getOutputStream();

Any idea on how to get this to work on my windows box?

Dean Hoover

Jul 17 '05 #1
0 5026

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: W.Guerlich | last post by:
I've got a Java servlet that delivers large database resultsets transformed to Excel with the HSSF library. In some cases it takes more than 15 minutes before transformation is done and content can...
by: Patrick | last post by:
I am trying to download the html page at http://www.dreamteamfc.com/dtfc04/servlet/PostPlayerList?catidx=1 Using the code public class DownloadWebPage { public static void main (String...
by: Vasil Slavov | last post by:
I apologize for the long email. I hope somebody will have time to read it and give some suggestions. I am working on a school project written in Python (using mod_python) and I need to upload a...
by: Matthew Flower | last post by:
I'd like to generate a JavaScript file from a servlet. Mozilla 1.5 seems to have no problem with this, but IE 6.0 is not cooperating. I've created a very simple test servlet that writes one...
by: dave | last post by:
When i hit a button in the web page, the servlet will run and should post some dynamic data into the new window (using Java Script), The new generated window will contain the info generated from...
by: moris7 | last post by:
Hi everyone, i tried a lot but i don't seem to be able to do anything conclusive ! Here what i want to do : LogIn in a webpage using this URL : ...
by: ErikaW | last post by:
Hi all, I've tried to google this but could not find a clear solution. I have a Web application developed in JDevloper using mostly html and Javascript. I have a pre-defined PDF form which I merge...
by: laksh2007 | last post by:
Hi all, I am new to this programing. can any one help me to proceed with my coding - to download a file from a remote location. i have writtent he following code: <body> Click <a...
by: laksh2007 | last post by:
Hi all, I am new to this programing. can any one help me to proceed with my coding - to download a file from a remote location. i have writtent he following code: <body> Click <a...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.