You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Parker <cp...@cya.ca.gov> on 2002/12/09 17:01:33 UTC

REPOST: SSL and setContentType() and "secure and nonsecure items"

Greetings all,

Apologies in advance for the blatant repost; I originally posted Friday
afternoon, and I'm not sure if I got lost in the 'it's Friday - let's go
home' shuffle or if nobody knows how/wants to help.

----------Original Message---------------

No doubt there's a simple way around this, but I can't find it.  I have some
dynamic content that is being sent to the user's browser as PDF on an SSL
enabled page.  When the user goes to the page, she gets the message "This
page contains both secure and nonsecure items."

I've traced the problem to this method call:
response.setContentType("application/pdf");

When I set the content type, I get the error message.  When I don't set the
content type, the user is prompted to download the file as an http download
(which is obviously correct behavior).  Is there another way to set the
header?  Do I need to encode the header into the ByteArrayOutputStream by
hand?

-- A somewhat truncated code snippet --

ByteArrayOutputStream baos = GoSomeplace.getPdfContent();
ServletOutputStream out = response.getOutputStream();
response.setContentLength( baos.size() );
response.setContentType("application/pdf"); //Causes error message
baos.writeTo( out );
out.flush();



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>