"Christopher Schultz" <ch...@christopherschultz.net> wrote in message 
news:4a32c4e3.6060...@christopherschultz.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Anthony,
>
> On 6/12/2009 1:47 PM, Anthony J. Biacco wrote:
>> Well, they used to be static JS files, then we decide we wanted more
>> flexibility in the content that went into them, so we stuck them in a
>> database and decided to generate them as needed.
>
> Er.. SELECT LENGTH(content), content FROM content_table?
>
> Or are you saying that you get some kind of template from the database
> and fill-in the details dynamically.
>
> I have to imagine that you could figure out the length of this data
> before you start streaming it back to the client. In that case, you
> simply have to provide your own Content-Length header.
>
> This just sounds like you're making it harder than it is.
>

Generally going to agree with Chris here that you're making it harder than 
it is.  If you are sending files on the order of about 12Kb (as specified in 
another post), then just put a Filter in front of it that wraps the response 
and the wrapper buffers the content, and then sets the content-length header 
when control returns to the Filter.  I did one of these as a toy a few years 
back (meaning that the coding style is awful), but it worked fine.  Of 
course, this doesn't work well if you expect to send multi MB sized files.

> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkoyxOMACgkQ9CaO5/Lv0PD/GQCgwEZm3lMeEoSww1P/4gBysiQi
> 8lcAnitGUVWQNzCA2LNVT+jwdnAZDQAF
> =tS84
> -----END PGP SIGNATURE----- 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to