tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Peformance on socket reads
Date Fri, 15 May 2009 16:06:20 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 5/14/2009 8:34 AM, David kerber wrote:
>   len = req.getContentLength();
>   b = new byte[ len ];

Don't forget to check to see if getContentLength() returned zero.

What is the content-type here? Is it application/x-www-form-urlencoded?
Are you calling req.getParameter() or any of the same family of
functions? If both of those are true, then Tomcat has already read the
body of the request, and you won't be able to re-read it.

>   iStream = req.getInputStream();
>    /* this is the line 198 that the above thread dump is waiting for: */
>   strLen = iStream.read( b, 0, len );
>   iStream.close();

If you want a String, why not use req.getReader() instead of
req.getInputStream()?

I think you may have better luck reading until there is no more input,
rather than relying upon the Content-Length matching the available data
(which really /should/ work, but obviously something else is happening
here).

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

iEYEARECAAYFAkoNkvwACgkQ9CaO5/Lv0PC6LgCeKxfj76DEe3zvkp7xLAvyDd5b
WYEAoJLpw50J6iGdu2s0QPeL5Q+eoRB9
=uYLB
-----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