You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hookom, Jacob" <Ja...@redline.mckhboc.com> on 2004/01/08 21:32:04 UTC
RE: Problems streaming PDF over HTTPS to IE
What exactly is the issue? You said you are having problems and are
referencing caching headers, but what are you seeing happen?
-Jake
-----Original Message-----
From: Brown, James [mailto:james.brown@ca.unisys.com]
Sent: Thursday, January 08, 2004 2:36 PM
To: Struts Users Mailing List
Subject: Problems streaming PDF over HTTPS to IE
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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org