This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have the following problem. I had a servlet running with HTTP (IPlanet 6 and Tomcat 4, using jdk1.3, jsse installed) which returned a comma seperated file using the following code:
//name variable is filled .... response.setContentType("text/plain"); response.setHeader("content-disposition", "attachment;filename=\"" + name + ".txt\""); ... // not interesting code // line.toString does return a value ... out.println(line.toString()); out.flush(); out.close();
This worked fine, however now I want to do the same while using HTTPS. This results in a download problem, because the browser claims that the file does not exist. JSP's seams to work fine.
When I remove the "response.setHeader" line, the contents of the generated file, appears in the browser window just fine, but I want to force the download.
So this leads to my question, if it is possible to send attachments with HTTPS using a servlet? Is there a solution to my problem? Are there other suggestions???
Which browser? IE has a setting to prohibit saving files to disk from secure sessions, and you will want to check this. "Tools->Internet Options...->Advanced" Scroll to the bottom and make sure that "Do not save encrypted pages to disk" is unchecked.
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!