Sorry if this has come up before, but I'm at a bit of a loss. I tried
searching the archives, but I didn't see a particularly obvious way of
doing that. I manually scanned, but that didn't turn up anything
At any rate, here is my problem.
I have a Tomcat 4.0 application with Form Based security. So, I started
out by using a WebConversation to get my unprotected home page and grab
the link to the main (secured) navigation page. Everything is great so
far. I now follow that link, again using the WebConversation to obtain a
new response object. I'm expecting it to be my login form page where I
can post my login information.
Here's the catch. TC sends a 302 response back with an empty body. The
header debug from HttpUnit looks like
Header:: HTTP/1.1 302 Moved Temporarily
Header:: Content-Length: 0
Header:: Date: Fri, 22 Mar 2002 22:22:20 GMT
Header:: Server: Apache Tomcat/4.0 (HTTP/1.1 Connector)
Header:: Set-Cookie: JSESSIONID=D2B1B5544700E5228484819612D4F2B1;Path=/cm
So,HttpWebResponse determines that 302 < HttpURLConnection.HTTP_BAD_REQUEST,
so it gets the input stream and calls loadResponseText.
So, loadResponseText gets the input stream and tries to read from it.
You would expect it to return -1 immediately and the loop would exit.
However, the stream now blocks forever (effectively, I haven't waited for
a full timeout, which is useless to me).
When I call inputStream.available(), I get 0 bytes back.
So, the obvious solution would be to check the Content-Length header
before trying to read the input stream. I'm happy to provide a patch if
requied, but I wanted to check to make this isn't a known issue first.
Thanks in advance.
SOMA Networks, Inc.