tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: slow servlet filter for ByteArrayOutputStream response Wrapper
Date Tue, 01 Jun 2010 14:06:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 6/1/2010 5:41 AM, Konstantin Kolinko wrote:
> 2010/6/1 Manny Mondeo <mannynab@yahoo.com>:
>>          httpRes.setContentLength(content.toString().length());
> 
> Also, the above, or simplier "content.length()", will give you the
> length measured in characters,  but Content-Length must be the length
> measured in bytes.  For a multi-byte charset such as UTF-8 those are
> certainly not the same. (Unless all your characters are 7-bit).

I would think that this would be the problem, except that
charCount(utf8str) <= byteCount(utf8Str), so the worst thing that could
happen is that the Content-Length was too /short/, and the browser would
either read everything anyway, or ignore the extra bytes. A too-long
Content-Type can definitely cause a browser to stall.

I like this error better as the cause:

> >          //PrintWriter out = httpRes.getWriter();
> >          PrintWriter out = wrapp.getWriter();
> Why wrapp.getWriter(); ??

Certainly writing to the buffered response and never to the actual
response will not send any data to the browser. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwFE/UACgkQ9CaO5/Lv0PDnYACgwCosffsg66HpD7f443xYhscx
of4An00pZmi8lbb8Ef3PJO+9Kr+k7n87
=q0Fl
-----END PGP SIGNATURE-----

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


Mime
View raw message