tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Ratica" <>
Subject Inputstream blocking during read, when there is nothing to read
Date Wed, 04 Apr 2001 15:37:04 GMT
If I send an empty get request to my servlet, get the inputstream, and do a
read it will block forever.
(eg: just call the servlet from IE or Netscape it just hangs).

InputStream in = servletRequest.getInputStream();
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
int read = 0;
do {
      read =;
      if(read>=0) { byteStream.write(buffer, 0, read); }
} while (read >= 0);

"getBody2" is never printed.
In Tomcat 3.2 I had the same problem
In Tomcat 3.3 the read would return, but -1 would never be returned, so it
would loop forever.

This servlet works fine on iplanet, and vqserver.

Also the size returned is -1, so I can't just slurp it into an array.

Thank you,
Adam Ratica
Software Architect
CardinalCommerce, Inc.
6119 Heisley Road    Mentor, OH 44060
440-352-8444 x138    440-352-1646 Fax

View raw message