File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Sending attachments with HTTPS / SSL using servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sending attachments with HTTPS / SSL using servlets" Watch "Sending attachments with HTTPS / SSL using servlets" New topic

Sending attachments with HTTPS / SSL using servlets

Arno Diederik

Joined: Apr 29, 2003
Posts: 3
Hi all,

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.setHeader("content-disposition", "attachment;filename=\"" + name + ".txt\"");
// not interesting code
// line.toString does return a value

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???

Thanks in advance,


Arno Diederik
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
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!
I agree. Here's the link:
subject: Sending attachments with HTTPS / SSL using servlets
It's not a secret anymore!