Re: servlet file download works in Firefox, but not in IE

Hendrik Schreiber <hs-doAduxQln/dWk0Htik3J/[email protected]>
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <[email protected]>
Joshua,

Hm - never seen that before. Have you tried deleting the IE cache?

Another idea - what's the URL that you are using for this? Can you  
try using a URL that actually looks like a real filename.

I.e. for a JPEG have a name like image.jpeg?

If that works, you might have to set the content-disposition header  
(http://www.faqs.org/rfcs/rfc2616 19.5.1) to suggest a filename.

-hendrik


On Mar 20, 2006, at 17:08, Jianshuo Niu wrote:

> Thanks for your prompt reply.
>
> It pops up a download window and the following error message window  
> after:
>
> Internet Explorer can not download ... from  ...
> the file could not be written to the cache.
>
> The data stays in a byte[] before it is written to the output stream
>
> Joshua
>
>
>
> On 3/20/06, Hendrik Schreiber <hs-doAduxQln/dWk0Htik3J/[email protected]> wrote: Hey,
>
> you should probably post some description of how IE fails... Any
> messages etc.?
> part from that: You cannot set the status after you have written the
> data, unless all of the data is cached in the buffer. Setting OK (the
> default value) after writing is fairly pointless anyway. So, I'd
> recommend removing that line.
>
> -hendrik
>
>
> On Mar 20, 2006, at 16:43, Jianshuo Niu wrote:
>
> > Hi!There:
> >
> > I wrote a java servlet to display binary files, such as html, doc,
> > pdf, jpg files. And the function works under firefox browser, but
> > failed in IE with PDF and Word file type.
> >
> > Here are part of the code:
> > //
> > response.setContentType(attachment.getImage ().getContentType());
> >       response.setContentLength(attachment.getImage().getImageSize 
> ());
> >       OutputStream os = response.getOutputStream();
> >       os.write(attachment.getContent());
> >       response.setStatus(HttpServletResponse.SC_OK);
> >
> > //
> > I did some study and tried to add the following line.
> > response.setHeader("Pragma","public");
> >  And it failed as well.
> >
> > Can anybody help me on this issue?
> >
> > Thanks
> >
> > Joshua
> >
> > _______________________________________________
> > Juglist mailing list
> > [email protected]
> > http://trijug.org/mailman/listinfo/juglist_trijug.or
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.