> If I understand your code correctly, you are loading all the bytes of > the file (or BLOB) into memory at once, without good reason (a good > reason might be if several objects were editing an XML document before > it was to be served). > > I would use a variable (but small) buffer size. Then I would read from > the source (file) until the buffer is filled. Then I would empty the > buffer to the destination (response output stream) before reading any > more from the source into memory. Repeat until finished. In other words, > stream the content.
Excellent point, I hadn't thought of that. I'll most certainly modify the code accordingly. Thanks very much for that! :) > cache-control - used by browsers and proxies to determine wether to cache > the document or not, and if so, for how long. Hmm, seems a bit odd to me to be setting this header in a case such as this... I would think you'd want the same cacheing scheme for a given user that they have all the time, be it proxy cache or browser cache or something else. I'll have to think about this one some more. > content-length - not sure if struts would do this for you, but i know > there > are issues with some browsers not liking binary data that it doesnt know > the > length of. Especially applies to pdfs. Oops, oversight on my part. The code I use in production in fact DOES set this header, but I neglected to put it in the code I posted. My bad, as the young folk say :) > Content-disposition - this is *very* usefull. You can specify inline or > attachment. Inline tells the browser to display the file in the browser. > (eg. the normal default behaviour for pdfs). Attachment tells the browser > that the file is to be downloaded rather than viewed, so the browser > should > show the 'save file' dialog box. Using filename=... with this allows > you to > specify a filename for the attachment. So, if you have an action > download.do?id=6, it can say filename is tradereport-march-2004.pdf! Very > useful for reports, etc where you would otherwise have many files with the > same 'default' filename, ie report.pdf/whatever the browser decides. > Can be > used to reduce admin cockups!!! Yep, I knew about this one too, but I didn't consider it putting this code together. Strikes me as another parameter, would you agree? I try and roll in the two definite changes tomorrow, and maybe even this last one, and re-post the code. Thank you very much for your feedback! Frank --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]