Re: servlet file download works in Firefox, but not in IE
"Jianshuo Niu" <[email protected]>
| Newsgroups | gmane.org.user-groups.trijug.juglist |
|---|---|
| Message-ID | <[email protected]> |
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. And I removed the last line, but it still did work. Joshua On 3/20/06, Jianshuo Niu <[email protected]> wrote: > > and I removed the last line, but it still did not work > > > On 3/20/06, Jianshuo Niu <[email protected]> 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 > > > > > > -- > Jianshuo Niu > -- Jianshuo Niu _______________________________________________ Juglist mailing list [email protected] http://trijug.org/mailman/listinfo/juglist_trijug.org