StreamingResolution +IE6 problem

View: New views
5 Messages — Rating Filter:   Alert me  

StreamingResolution +IE6 problem

by Alex Wibowo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,


I'm having a problem with IE6.
My code is as follow:
-------------------------------------------------------------------------------

 BufferedInputStream bis =  new BufferedInputStream(new FileInputStream("c:/bla.pdf"));
 ByteArrayOutputStream baos = new ByteArrayOutputStream();

response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate");
response.setHeader("Content-Disposition", "attachment;filename=\"bla.pdf\"");
 response.setHeader("Pragma", "public");
response.setContentType("application/pdf");

        int bytesRead;
        byte[] buff = new byte[4096];
        while ((bytesRead=bis.read(buff)) > 0) {
            baos.write(buff, 0, bytesRead);
        }
        bis.close();
        baos.close();
        response.setContentLength(baos.size());
  baos.writeTo(response.getOutputStream());
-------------------------------------------------------------------------------

THat will popup a dialog, where user can choose to open, save or cancel.
Saving is fine, but choosing to 'open' it in IE6 will open acrobat reader, with error message 'file cannot be found'.

I've noticed that some guy encountered the same problem:
http://www.mail-archive.com/stripes-users@.../msg02126.html

and I tried to follow his suggestion without any luck. (somehow my http response has cache-control: no-cache )


This only happen with stripes.
If I do the following in a plain servlet:

-------------------------------------------------------------------------------
 BufferedInputStream bis =  new BufferedInputStream(new FileInputStream("c:/bla.pdf"));
        BufferedOutputStream bsos = new BufferedOutputStream(response.getOutputStream());

        response.setHeader("Expires", "0");
        response.setHeader("Cache-Control", "must-revalidate");
        response.setHeader("Content-Disposition", "attachment;filename=\"bla.pdf\"");
        response.setHeader("Pragma", "public");
        response.setContentType("application/pdf");

        int bytesRead;
        byte[] buff = new byte[4096];
        while ((bytesRead=bis.read(buff)) > 0) {
            bsos.write(buff, 0, bytesRead);
            bsos.flush();
        }
        bis.close();
        bsos.close();
-------------------------------------------------------------------------------

It works ok.


Has anyone ever had this problem before?


Thanks in advance for the help!




--
Best regards,


WiB


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: StreamingResolution +IE6 problem

by M.C.S. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Alex,

do you somewhere use the stripes-provided StreamingResolution class?
Passing in the parameters ContentType, InputStream and filename creates
a working StreamingResolution for me - in IE6, too. Manipulating the
response itself should not be neccessary as well as (anonymously)
subclassing StreamingResolution.

Kind regards,
Marcus


Alex Wibowo schrieb:

> My code is as follow:
> -------------------------------------------------------------------------------
>
>  BufferedInputStream bis =  new BufferedInputStream(new
> FileInputStream("c:/bla.pdf"));
>  ByteArrayOutputStream baos = new ByteArrayOutputStream();
>
> response.setHeader("Expires", "0");
> response.setHeader("Cache-Control", "must-revalidate");
> response.setHeader("Content-Disposition",
> "attachment;filename=\"bla.pdf\"");
>  response.setHeader("Pragma", "public");
> response.setContentType("application/pdf");
>
>         int bytesRead;
>         byte[] buff = new byte[4096];
>         while ((bytesRead=bis.read(buff)) > 0) {
>             baos.write(buff, 0, bytesRead);
>         }
>         bis.close();
>         baos.close();
>         response.setContentLength(baos.size());
>   baos.writeTo(response.getOutputStream());
> -------------------------------------------------------------------------------
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: StreamingResolution +IE6 problem

by Krzysztof Osiecki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alex Wibowo <alexwibowo@...> writes:
>THat will popup a dialog, where user can choose to open, save or cancel.Saving
>is fine, but choosing to 'open' it in IE6 will open acrobat reader, with error
>message 'file cannot be found'.

I had similar problem using HTTPS and disabling caching. It seems that IE reads
attached PDF file, saves as temporary file and then removes it from disk before
serving it to external reader, make it Adobe Reader or anything.

I changed Expires header to now + couple seconds and it works fine.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: StreamingResolution +IE6 problem

by Alex Wibowo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys...


Thanks a lot for the reply. It turns out that the bug was due to something else.
We store something in the cookie. Which causes the following http header to be sent

Cache-Control: no-cache="set-cookie"

and when IE6 sees this header, it deletes the file :(


the fix for us, is not to store anything in the cookie :(


Regards,


On Fri, Oct 23, 2009 at 2:18 AM, RomeoAD <romeoad@...> wrote:
Alex Wibowo <alexwibowo@...> writes:
>THat will popup a dialog, where user can choose to open, save or cancel.Saving
>is fine, but choosing to 'open' it in IE6 will open acrobat reader, with error
>message 'file cannot be found'.

I had similar problem using HTTPS and disabling caching. It seems that IE reads
attached PDF file, saves as temporary file and then removes it from disk before
serving it to external reader, make it Adobe Reader or anything.

I changed Expires header to now + couple seconds and it works fine.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Best regards,


WiB


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: StreamingResolution +IE6 problem

by Terrell Weatherford :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We ran into this problem and found a solution a few months ago.
Setting the Cache-Control header to "" (blank) or "private" seemed to
fix the https and PDF issue from what I recall.

On Thu, Oct 22, 2009 at 6:04 PM, Alex Wibowo <alexwibowo@...> wrote:

> Hi guys...
>
>
> Thanks a lot for the reply. It turns out that the bug was due to something
> else.
> We store something in the cookie. Which causes the following http header to
> be sent
>
> Cache-Control: no-cache="set-cookie"
>
> and when IE6 sees this header, it deletes the file :(
>
>
> the fix for us, is not to store anything in the cookie :(
>
>
> Regards,
>
>
> On Fri, Oct 23, 2009 at 2:18 AM, RomeoAD <romeoad@...> wrote:
>>
>> Alex Wibowo <alexwibowo@...> writes:
>> >THat will popup a dialog, where user can choose to open, save or
>> > cancel.Saving
>> >is fine, but choosing to 'open' it in IE6 will open acrobat reader, with
>> > error
>> >message 'file cannot be found'.
>>
>> I had similar problem using HTTPS and disabling caching. It seems that IE
>> reads
>> attached PDF file, saves as temporary file and then removes it from disk
>> before
>> serving it to external reader, make it Adobe Reader or anything.
>>
>> I changed Expires header to now + couple seconds and it works fine.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Stripes-users mailing list
>> Stripes-users@...
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
>
> --
> Best regards,
>
>
> WiB
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@...
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users