Another solution is to have the link to download the pdf appended with a
random parameter.

<a href="/download/report.pdf?state=<%=System.currentTimeMillis() %>"
>Download</a>



-----Original Message-----
From: Brice Ruth [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 2:47 PM
To: Struts Users Mailing List
Subject: Re: Problems streaming PDF over HTTPS to IE

I've overcome this by simply setting the "name" of the PDF that is 
streamed to have a timestamp, so its different everytime its loaded and 
IE doesn't think its cached. I had no luck with any of the HTTP headers.

Brown, James wrote:

>We are having a problem streaming a PDF to Internet Explorer over HTTPS.  I
have located a number of postings (namely
http://support.microsoft.com/default.aspx?scid=kb;en-us;316431) that denote
this as a known feature/bug in IE; however, we can't seem to get the
solution correct.
>
>As we would like all of the application to be non-cacheable, we have set
the following in the struts-config.xml
>  <controller>
>    <!--  Set pages as no-cache -->
>    <set-property property="nocache" value="true"/>
>  </controller>
>Which works as expected.
>
>In the Action class we attempt to override the nocache via:
>          response.setHeader("Cache-control", "");
>
>This does not appear to have the effect of overriding the controller
setting.
>
>Any thoughts?
>
>
>                                  Cheers,
>                                  James
>Below is a larger snippet from the Action.execute(...) method.
>
>
>  public ActionForward execute(ActionMapping mapping,
>                               ActionForm form,
>                               HttpServletRequest request,
>                               HttpServletResponse response)
>    throws IOException, ServletException {
>    HttpSession sess = request.getSession();
>
>    String report = "XYZ.pdf";
>    // stream the PDF data to the browser
>    if (report != null) {
>      javax.servlet.ServletOutputStream sos = response.getOutputStream();
>      try {
>        response.setContentType(PDF_MIME_TYPE);
>        // as per
http://support.microsoft.com/default.aspx?scid=kb;en-us;316431
>        // Internet Explorer will not be able to display the PDF in SSL
unless
>        // the page is set to be cacheable
>        response.setHeader("Cache-control", "");
>        File reportFile = new File(report);
>        FileInputStream fis = new FileInputStream(reportFile);
>        byte[] fisBytes = new byte[(int) reportFile.length()];
>
>        fis.read(fisBytes);
>        response.setContentLength(fisBytes.length);
>        sos.write(fisBytes);
>        sos.flush();
>        sos.close();
>      } catch (Exception e) {
>        ActionErrors errors = new ActionErrors();
>        errors.add(ActionErrors.GLOBAL_ERROR,
>                   new ActionError(Constants.ERROR_KEY_HDR +
Constants.LC_ERROR_HDR + "5001"));
>        saveErrors(request, errors);
>      } finally {
>        sos.close();
>        response.reset();
>      }
>    }
> . . .
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers. 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to