[Opensource] File downloads
Vincent Gogan
vincent.gogan at goganinc.com
Wed Apr 14 11:41:35 PDT 2004
Thanks Malc, but it doesn't seem like this is my magic bullet :-/
I've kept on experimenting and it seems that IE6 with the Adobe plugin
sends multiple requests for a PDF file. The biggest difference in the
headers static PDF files are delivered with an ETag. The second request
then asks if it has changed and since the answer is 'No', things move
forward.
With a streamed response, I don't generate an ETag but I generate everything
else including the Last-Modified header. Adding in "Accept-Ranges" doesn't
change much and I never see a 'Range' or 'If-Range' header.
The behaviour I get is that I receive two requests. If I have
'Accept-Ranges', the
first one closes the connection after about 10K or so. The second one seems
to be the one that counts and it hangs. Manually hitting the 'stop' button
closes the connection and I see that about 170K/210K were sent.
With 'Accept-Ranges' removed, the first request completes successfully (is
not terminated prematurely) and the second one still hangs.
In some testing I even saw a 'contype' userAgent come up... I thought those
were an IE5 artifact that went away! Anyway, those are easy to handle so
I'll
ignore them.
Back to my current problem, I'm not sure what my next step is. Probably to
try and generate an ETag for the file I'm sending back. I don't have high
hopes though.
Surely this is a known problem... there must be tons of dynamically
delivered
PDF files being generated each day.
As an aside, I've noticed that IE6 is aggressive with closing
connections. For example, images fetched via JavaScript are no longer
cached in IE6 (prefetching doesn't do anything) so moving a mouse over a
rollover menu gives a server a good workout. Moving it quickly actually
causes IE6 to close the connection prematurely.
Vincent
> -----Original Message-----
> From: opensource-bounces at jcorporate.com
> [mailto:opensource-bounces at jcorporate.com]On Behalf Of Wise, Malcolm
> Sent: Wednesday, April 14, 2004 3:01 AM
> To: 'JCorporate Open Source Listserv'
> Subject: RE: [Opensource] File downloads
>
>
> Vincent,
>
> Try calling
>
> HttpServletResponse.reset()
>
> before setting the headers. The below posting was mine and this
> solved this
> particular problem :)
>
> Cheers,
> Malc
>
> -----Original Message-----
> From: Vincent Gogan [mailto:vincent.gogan at goganinc.com]
> Sent: 14 April 2004 03:38
> To: opensource at jcorporate.com
> Subject: RE: [Opensource] File downloads
>
>
> Perhaps my problem is related to these earlier postings. My
> issue relates to inline display of PDF's in IE6.
>
> I battled this a while ago and decided that the only cross-browser
> thing to do was to set the Content-Disposition to "attachment" and
> let the user decide to open/save.
>
> This recently came back to bite me as we have users who specifically
> want the plugin to be used. Now, setting the Content-Disposition to
> "inline" seems to work in IE6 but I get a really nasty error message
> from the plugin saying:
>
> "There was an error opening the document. The file is damaged
> andcould not be repaired."
>
> I am conditionally delivering the pdf file and use "setCustomResponse()"
> to control the response. I then write the stream as the PDF is, in some
> sense, dynamic.
>
> After lots of Google searches and experimenting, I'm down to two
> ideas:
>
> 1. The plugin uses the 'range' header to selectively download
> portions of the file. The DefaultServlet would handle this (which
> would explain why the plugin can view static files) but perhaps
> this is not supported in the Struts/Expresso mechanism.
>
> I can't see any 'range' header but perhaps this is part of the
> problem.
>
> 2. Setting cookies screws up the plugin.
>
> I've already cleaned up the other IE issues (cache-control & pragma
> headers) but am stuck. Any ideas. Does this ring a bell?
>
> Vincent
>
> > -----Original Message-----
> > From: opensource-admin at jcorporate.com
> > [mailto:opensource-admin at jcorporate.com]On Behalf Of Michael Rimov
> > Sent: Sunday, October 19, 2003 12:47 AM
> > To: opensource at jcorporate.com
> > Subject: Re: [Opensource] File downloads
> >
> >
> > At 02:12 AM 10/17/2003, you wrote:
> > >May be slightly OT, but maybe someone can give me some pointers...
> > >I'm migrating from Expresso 5.0 to 5.3 (using RC5 at present).
> > When testing
> > >my file downloads from one site I hit a problem which seems to be IE6
> > >specific (works on NS 7.1 and Opera). I click on the link to
> > download the
> > >file (these are held in my Sybase ASE12 database) and click the 'Open'
> > >button on the resulting dialog. The appropriate application opens, but
> > >complains that it can't find the file. It seems to be looking
> > in subfolder
> > >'Content.IE5\[random characters]\filename(1).doc' within my
> Internet temp
> > >files folder. I can't see this folder anywhere (but a Google
> > search seems
> > >to suggest that this is nothing unusual!).
> > >The strange thing is that another site I've converted to 5.3RC5
> > (running on
> > >the same server) doesn't have this problem. I still have a
> > server running
> > >the Expresso 5.0 version of the app and this works with IE6. I
> > use Sybase
> > >EAServer 4.2.2 for testing and production, but I've also
> tested both the
> > >version 5.0 and 5.3 based apps in Tomcat 4.1.27 with IE6 and
> get the same
> > >result - the 5.0 app works and the 5.3 one doesn't! If I choose
> > to save the
> > >file to disk this works OK, and I can then open it.
> >
> > Malc,
> >
> > Definitely Off topic! I've been fighting this one too. I originally
> > thought it was a patch to IE that messed things up, since this
> > appeared so
> > suddenly... about the time I updated to Acrobat 6. In fact, if you want
> > something REALLY weird, do download. The redirect link won't
> > work, but the
> > "click here if download does not commence" works great. I have
> confirmed
> > that this is VERY IE related, and Mac Safari browser works well too.
> >
> > I'm glad to hear that 5.0 works though because that gives me
> something to
> > work with. While playing with it, I found out that reading in the whole
> > file and outputting it in one out.write() call helped, but 5.0
> never even
> > tried anything like that.
> >
> > I checked and the header setting code is _identical_ between 5.0 and
> > 5.3. The JSP pages are identical too. Perhaps there's something
> > going on
> > at the controller level that I need to check [or possibly a side-affect
> > interaction with Struts]
> >
> > I'll keep looking through it.
> > -Mike
> >
> >
> >
> >
> > _______________________________________________
> > Opensource mailing list
> > Opensource at jcorporate.com
> > http://mail.jcorporate.com/mailman/listinfo/opensource
> > Archives: http://mail.jcorporate.com/pipermail/opensource/
> >
>
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mailman.jcorporate.com/mailman/listinfo/opensource
>
>
> ******************************************************************
> ****************************
> The information contained in this message or any of its
> attachments may be confidential and is intended for the exclusive
> use of the addressee(s). Any disclosure, reproduction,
> distribution or other dissemination or use of this communication
> is strictly prohibited without the express permission of the
> sender. The views expressed in this email are those of the
> individual and not necessarily those of Sony or Sony affiliated
> companies. Sony email is for business use only.
>
> This email and any response may be monitored by Sony United
> Kingdom Limited.
> (05)
> ******************************************************************
> ****************************
>
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mailman.jcorporate.com/mailman/listinfo/opensource
>
More information about the Opensource
mailing list