0 Replies Latest reply on Jul 30, 2004 4:24 PM by Michael Bauer

    JBoss 3.2.5 Breaks Servlet Uploads (upgrade from 3.2.1)

    Michael Bauer Newbie

      I have found a workaround for my problem, but thought I would share some findings we made on JBoss 3.2.5.

      Using STRUTS 1.1, we have a form that, upon clicking a link, sends the user a CSV file. The process for doint this is to:

      set the content type to "file/csv"
      set the header Content-Disposition to indicate the filename
      Grab the OutputStream from HttpServletResponse and write the data

      What we found is that in 3.2.5 (Tomcat 5.x), the headers have changed enough to cause Internet Exporer to freakout (errors download, doesn't get the file name/type right).

      Upon further investigation, we saw a couple of oddities in the headers. First off, it was missing the Content-Lenght, which in 3.2.1 was generated for you. Second, it had three new headers: Pragma, Cache-Control, and Expires (which was set to Wed, Dec 17 1969 19:00:00 EST). Some experimentation showed that by setting Pragma and Cache-Control to null and setting Expires to a lagitamate date sometime in the future, and adding a proper Content-Lenght, everything works again. Failure to do any one of those will result in utter error.

      Just to be thorough, I also threw together a very simple HttpServlet that simply mocks up a CSV file and sends it. As expected, it did not work. Instead of an error, however, Internet Explorer treated content as HTML and just threw it to display (past operations cause it to prompt opening in Excel or to save the file).

      As no errors were thrown on the server side, I have no logs to share, but I invite everyone to do the same test. I would be interested to know if anyone else is seeing similar problems.

      Mike Bauer