-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

Like most folks on the list, I have quite a few dynamic resources
being served through Tomcat. For nearly all of them, the
Content-Length response header is /not/ included in the response
because either content length isn't known when the response is
committed, and therefore the Content-Length header simply cannot be
sent or the response is not being buffered in the application, and so
the application isn't counting bytes and doesn't know the content
length even if it could be reported.

I'm wondering if Tomcat can do anything about that.

Here's the situation I have: I've got a response that I'm fairly sure
fits into the response's buffer size, and I'd like to send a
Content-Length header in that case. I could probably put a wrapper
around the response's ServletOutputStream that counts bytes and then
looks for "done" conditions (OutputStream.close, etc.), then adds a
Content-Length header if the response hasn't yet been committed.

I wonder if Tomcat could do something like that more easily -- since
the buffer is being managed by Tomcat already, and Tomcat knows when
the response will be committed/completed.

So,

A: Is this something that Tomcat can do already? I don't see any
configuration options that sound like they would do this kind of thing.

B: Is this something appropriate for a container to do in general?

C: If I were to write a Filter to accomplish this manually, are there
any potential dangers if a traditional non-synchronous
request/response is being processed?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRUbePAAoJEBzwKT+lPKRYOGYP/Aos+mNfVqYKBNKNBeVzvDyr
Io2y3uWlHi3E5nYza9v+mqCmkwgmCycEKgwj96bceJM3mBgzhjmr0tTXNBB7PJGF
7HWwrOYGq1JtyT/dHdEnj6swd431beHZ1+9YvMTBI68OVPXLVNCapvMw88i7C4cG
B6CGY1XIpmjBG701MhdlDDF9UMN2AwGEuQtHQAAD7d3tl51ilLVjHXURKviiHN/a
VuP5RFHF8lZfbT+JeGeX1rRH5+toLMdlhU9vbhdwMyTXVB7bpwoFm5ONbfcKmlRu
pLqHwY9wBGi9TjAxD2s1hxVozacL1wcX/eziH3rh9ZdwZIpHxLbZLSZB0+TJeWFC
ILg2NTQ40V8msGqHTx6R1PrGqaLeCrPZnps7VIETh8DbCb248dzjMnAXtzrFWIYb
toLliJMZIXhf2sx91FbVUxcm6siyoaJoqd7Wi1l0aLgXgk9ucQZVF32ZD2T8Rw0g
7ZRZAUkOc9sqijpX6JQ2no71H5G5GOKDahmOUwW3ErLl/upCIQQRnu/BB6kP4wxS
DzPchIuGFJFMiEz7x31ldes/2aRY4xOun10hX7fKcr3reOn0nupHV2iD7kFfNeLH
KCL4X+BV2J4f2DsPxf8CzGNxPnRMhu/iX8LuXmSxQZhfPBlCW9peztgR8MjTFzFk
FvoIBJUOfDNiX9N2jzKG
=n26I
-----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