You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Luis Pascual Forner <lp...@ival.com> on 2008/06/05 10:36:32 UTC

Error with content-type application/pdf and Internet Explorer

Hello,

   The JSP script that follows produces an error
when accessing with Internet Explorer:

<%@ page contentType="application/pdf" %>
<%@ page import="java.io.File" %>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.InputStreamReader" %>
<%

     InputStreamReader in = new InputStreamReader(
       new FileInputStream(new File("document.pdf")), "ISO-8859-1");
     char[] b = new char[128];
     int i = in.read(b, 0, 128);
     while (i >= 0) {
       out.write(b, 0, i);
       i = in.read(b, 0, 128);
     }
     in.close();

%>

More info:

* Tomcat version: 5.5.26.
* Internet Explorer open a download window, and then
   the error "No puede descargar xxxxxx de www.xxxx.es.
   El archivo no pudo ser escrito en la caché" (my
   IE is localized in spanish).
* The same script runs OK with Firefox in Linux and
   with Mozilla in Windows.
* The same script runs OK with Internet Explorer and
   Tomcat 5.0.19 + Apache 2.0.49.
* No messages in log.
* In the conf/web.xml file appears the mime-type
   "application/pdf".

regards,

   Luis

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Error with content-type application/pdf and Internet Explorer

Posted by Luis Pascual Forner <lp...@ival.com>.
Thanks, Steve

   With

     response.setHeader("Cache-Control", "cache");
     response.setHeader("Pragma", "cache");

runs OK in IE

regards,

   Luis

Steve Ochani escribió:
> Date sent:      	Thu, 05 Jun 2008 10:36:32 +0200
> From:           	Luis Pascual Forner <lp...@ival.com>
> Subject:        	Error with content-type application/pdf and Internet Explorer
> To:             	Tomcat Users List <us...@tomcat.apache.org>
> Send reply to:  	Tomcat Users List <us...@tomcat.apache.org>
> Organization:   	IVAL informática <http://www.ival.
> 	com>
> 
>> Hello,
>>
>>    The JSP script that follows produces an error
>> when accessing with Internet Explorer:
>>
> 
> Your problem seems to be very similar to some previous postings, including this:
> 
> http://www.nabble.com/PDF-problem-on-IE-from-JSP-td14879788.html
> 
> 
> I would search via google or one of the tomcat users archive.
> 
> 
> 
> 
>> <%@ page contentType="application/pdf" %>
>> <%@ page import="java.io.File" %>
>> <%@ page import="java.io.FileInputStream" %>
>> <%@ page import="java.io.InputStreamReader" %>
>> <%
>>
>>      InputStreamReader in = new InputStreamReader(
>>        new FileInputStream(new File("document.pdf")), "ISO-8859-1");
>>      char[] b = new char[128];
>>      int i = in.read(b, 0, 128);
>>      while (i >= 0) {
>>        out.write(b, 0, i);
>>        i = in.read(b, 0, 128);
>>      }
>>      in.close();
>>
>> %>
>>
>> More info:
>>
>> * Tomcat version: 5.5.26.
>> * Internet Explorer open a download window, and then
>>    the error "No puede descargar xxxxxx de www.xxxx.es.
>>    El archivo no pudo ser escrito en la caché" (my
>>    IE is localized in spanish).
>> * The same script runs OK with Firefox in Linux and
>>    with Mozilla in Windows.
>> * The same script runs OK with Internet Explorer and
>>    Tomcat 5.0.19 + Apache 2.0.49.
>> * No messages in log.
>> * In the conf/web.xml file appears the mime-type
>>    "application/pdf".
>>
>> regards,
>>
>>    Luis
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
>> e-mail: users-unsubscribe@tomcat.apache.org For additional commands,
>> e-mail: users-help@tomcat.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Error with content-type application/pdf and Internet Explorer

Posted by Steve Ochani <oc...@ncc.edu>.
Date sent:      	Thu, 05 Jun 2008 10:36:32 +0200
From:           	Luis Pascual Forner <lp...@ival.com>
Subject:        	Error with content-type application/pdf and Internet Explorer
To:             	Tomcat Users List <us...@tomcat.apache.org>
Send reply to:  	Tomcat Users List <us...@tomcat.apache.org>
Organization:   	IVAL informática <http://www.ival.
	com>

> Hello,
> 
>    The JSP script that follows produces an error
> when accessing with Internet Explorer:
> 

Your problem seems to be very similar to some previous postings, including this:

http://www.nabble.com/PDF-problem-on-IE-from-JSP-td14879788.html


I would search via google or one of the tomcat users archive.




> <%@ page contentType="application/pdf" %>
> <%@ page import="java.io.File" %>
> <%@ page import="java.io.FileInputStream" %>
> <%@ page import="java.io.InputStreamReader" %>
> <%
> 
>      InputStreamReader in = new InputStreamReader(
>        new FileInputStream(new File("document.pdf")), "ISO-8859-1");
>      char[] b = new char[128];
>      int i = in.read(b, 0, 128);
>      while (i >= 0) {
>        out.write(b, 0, i);
>        i = in.read(b, 0, 128);
>      }
>      in.close();
> 
> %>
> 
> More info:
> 
> * Tomcat version: 5.5.26.
> * Internet Explorer open a download window, and then
>    the error "No puede descargar xxxxxx de www.xxxx.es.
>    El archivo no pudo ser escrito en la caché" (my
>    IE is localized in spanish).
> * The same script runs OK with Firefox in Linux and
>    with Mozilla in Windows.
> * The same script runs OK with Internet Explorer and
>    Tomcat 5.0.19 + Apache 2.0.49.
> * No messages in log.
> * In the conf/web.xml file appears the mime-type
>    "application/pdf".
> 
> regards,
> 
>    Luis
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
> e-mail: users-unsubscribe@tomcat.apache.org For additional commands,
> e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org