struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Zammetti" <fzamm...@hotmail.com>
Subject RE: HTTP header for dynamic pdf and IE6
Date Fri, 04 Jun 2004 14:27:04 GMT
I'm doing this as well, and three things come to mind...

(1) For IE, you must set the response size or it'll choke.  Looks like your 
doing that already.
(2) Try adding response.setContentType("application/pdf"); to your code.  
That's the only extra thing I'm doing in my code.
(3) Acrobat integration with IE is known to be buggy, and that's being 
polite!  In Acrobat itself, there is an option to specify whether the PDF is 
opened integrated in the browser or in a separate window.  The former is 
many times problematic.  Try changing that option and see if your problem 
goes away.  In Acorbat 6.0, it's under the Edit menu, Preferences, the 
Internet "tab", and it's the Display PDF In Browser option.  Uncheck it, 
close Acrobat (make sure it's really closed, I find the Acrobat process 
keeps running most of the time, very annoying) and give it a try.

Hope that helps!

Frank


>From: "Dean A. Hoover" <dhoover@rochester.rr.com>
>Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
>To: struts-user@jakarta.apache.org
>Subject: HTTP header for dynamic pdf and IE6
>Date: Fri, 04 Jun 2004 08:37:45 -0400
>
>Sorry if this is inappropriate for this list,
>but I really don't know where else to turn. I
>figured someone on this list may have solved it.
>
>I have a java web application that allows
>an end-user in their browser to download
>a "file", which happens to be bytes stored
>in a database.
>
>In experimenting with how to do this, I have
>this snippet of code in my Action:
>
>            AttachmentListItem attachment =
>             EmailSQL.getAttachmentListItem(connection, 3, 1);
>            response.setContentType(attachment.getContentType());
>            byte[] data =
>             EmailSQL.getAttachmentBytes(connection, 3, 1);
>            response.setContentLength(data.length);
>            response.setHeader("Content-Disposition",
>             "attachment; filename=\"" + attachment.getFileName() + "\"");
>            ServletOutputStream out = response.getOutputStream();
>            out.write(data);
>            out.flush();
>            out.close();
>
>To test this out, I hit the link in my IE browser which brings up
>a dialog box allowing me to "Open" or "Save" the file. If I save
>the file, it does the right thing. If I press the open button, Acrobat
>Reader opens up and then errors out with an alert box:
>"There was an error opening the document. The file does not exist."
>
>I have a yahoo email account that I tried a test on. I sent an email
>message with the same pdf file attached to that account. I wanted to
>see if yahoo figured out how to make this work. They did! (but I can't
>figure out how to replicate)
>
>Their header looks like this:
>Date: Thu, 03 Jun 2004 15:37:58 GMT
>P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR
>ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi
>PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
>Content-Disposition: attachment; filename=reference.pdf
>Connection: close
>Transfer-Encoding: chunked
>Content-Type: application/pdf; filename="foo.bar"
>
>.s4g--&v=1
>
>There is also some other stuff I am seeing just after the header: .s4g-&v=1
>which looks something like a query string, but I'm not sure.
>
>My header looks like this:
>HTTP/1.1 200 OK
>Date: Thu, 03 Jun 2004 15:35:15 GMT
>Server: Apache/2.0.40 (Red Hat Linux) mod_perl/1.99_07-dev Perl/v5.8.0
>mod_jk/1.2.5 PHP/4.2.2 mod_python/3.0.1 Python/2.2.2 mod_ssl/2.0.40
>OpenSSL/0.9.7a
>Set-Cookie: JSESSIONID=DD3D0938B780EEBEBDC1B558CCBAD095; Path=/
>Pragma: No-cache
>Cache-Control: no-cache
>Expires: Thu, 01 Jan 1970 00:00:00 GMT
>Content-Disposition: attachment; filename="reference.pdf"
>Content-Length: 214982
>Keep-Alive: timeout=15, max=100
>Connection: Keep-Alive
>Content-Type: application/pdf;charset=UTF-8
>
>
>Does anyone know how to work around this problem? I suppose
>there are actually 2 parts to this:
>1) What is the magic in the HTTP header that allows this to work?
>2) How can one create such a header in java?
>
>Thanks.
>Dean Hoover
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message