tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Janner <Jeffrey.Jan...@PolyDyne.com>
Subject IE 8 and before refusing to download files (I hate IE)
Date Mon, 03 Jun 2013 18:00:47 GMT
Ran into an interesting problem today.  It seems that IE8 and before no longer likes how we
are sending BLOB files.
Worked last week as far as we can tell.  Works fine for IE9+ and other browsers, but IE8 is
suddenly giving us an error message, as though it is ignoring the response headers.
I'm not going to completely rule out the possibility it is in our code somewhere, but we haven't
found it yet.  We did also upgrade out app over the weekend, but the problem didn't show up
in our test environment (as far as we can tell).
Here is the relevant code:


    protected void viewAction(ServletContext ctx, HttpServletRequest req, HttpServletResponse
rsp)
            throws ServletException, IOException, PolyError {
        // Get beans
        ReportDashboardBean bean = (ReportDashboardBean) session.getAttribute(SessionConstants.REPORT_DASHBOARD_BEAN);

        // get request data
        int row = userBean.getLongValue(req, "ROW").intValue();
        ReportContentBean conBean = (ReportContentBean) bean.getContentList().get(row);

        //System.out.println("*** " + conBean.getFilename(false));

        rsp.setContentType(conBean.getDbObject().getMimeType());
        StringBuilder sbContentDisposition = new StringBuilder();
        if (conBean.getDbObject().getMimeType().indexOf("text/html") >= 0) {
            sbContentDisposition.append("inline; ");  // streamline output automatically
        } else {
            sbContentDisposition.append("attachment; ");  // ask user to "open" or "save"
content
        }
        sbContentDisposition.append("filename=").append(conBean.getFilename(false)).append(";");

        rsp.setHeader("Content-Disposition", sbContentDisposition.toString());
        conBean.getDbObject().getContent(rsp.getOutputStream());
   }

Works great if the MimeType is text/html, but anything else generates an error.
The getContent routine reads from the BLOB and copies it to the response output stream.
None of this code has changed, and the access log shows a 200 response and the full number
of bytes of the file.

Anybody have any ideas?

Server1 specs: Tomcat 6.0.33/Java 1.6.0_33/Windows 2003 SP2
Server2 specs: Tomcat 6.0.36/Java 1.6.0_34/Windows 2008 R2/SP1


Jeffrey Janner
Sr. Network Administrator
jeffrey.janner@polydyne.com<mailto:first.last@polydyne.com>
PolyDyne Software Inc.
Main:   512.343.9100
Direct:  512.583.8930

 [cid:image002.png@01CC0FB7.4FF43CE0]

Speed, Intelligence & Savings in Sourcing


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message