You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Francesco Marelli <to...@nemesi.co.uk> on 2006/08/01 16:47:59 UTC

Streaming PDF over HTTPS

Hi all,

I have setup the standard 8443 ssl connector in Tomcat after creating my own
certificate and everything works fine...

My application has a few servlets that generate dynamic pdf files using the
iText classes library. These work fine over http, but Tomcat gives me the
following message if I run the application over https

sun.security.validator.ValidatorException: No trusted certificate found

This only happens with the pdf servlets, not with the other parts of the
application... I am using IE 6, but I have the same problem with Firefox 1.5
and Netscape 8.1. Although I think this is a server side (Tomcat)
configuration issue, I mention the browser because I know IE has a bug with
streaming files over https. A workaround has been found and discussed here

http://forum.java.sun.com/thread.jspa?forumID=45&threadID=233446

I have tried to apply this, but to no avail... the code I use to stream is as
below:

/* ................. */

response.setContentType("application/pdf");
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");
response.setHeader("Content-Disposition", "attachment; filename=aaa.pdf" );			
	
// the contentlength is needed for MSIE!!!
response.setContentLength(baos.size());
// write ByteArrayOutputStream to the ServletOutputStream
ServletOutputStream out = response.getOutputStream();
baos.writeTo(out);
out.flush();						

/* ................. */

can anyone help with this, please?

Thank you very much for your help.

Francesco
ttps. A workaround has been 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Streaming PDF over HTTPS

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Francesco,

> These work fine over http, but Tomcat gives me the
> following message if I run the application over https
> 
> sun.security.validator.ValidatorException: No trusted certificate found

This usually indicates that Java is trying to make an HTTPS connection
to a server that does not have a trusted certificate installed locally.

So, first: does your servlet make any outgoing HTTPS connections? If you
are using something like Cocoon to do transformations or you are loading
up some kind of page description file over HTTPS, then this may be the case.

If you /are/ making such a connection, make sure that the cert for the
remote server (even if it is the local server :) ) has been imported
into your keystore that Java is using.

-chris