> I'm using this program called "loadsim" to get a simulation of a bunch of
> users using my webapp. This is a java program utilizing the
> java.net.HttpConnection to simulate the clients, built using large parts
> of a apache loadsimulation system, right?
>
> I just installed the webapp on TC4, and are experiencing some weird
> behaviour with the "sendRedirect()" stuff.
>
> If I don't get and close the output stream, the loadsim-clients wont ever
> shut down the Connection, and then, after the timeout of 60000 millis, TC4
> closes it. It then says 0 bytes received in the loadsim log.
>
> If I on the other hand go in to the server using a normal browser
> (Mozilla) during the test, I can browse it happily (The load-clients are
> of course still experiencing the same problem)..
>
> Basically, I have to do this to get it working:
>
>         try {
>             // Getting encoding
>             String encoding = res.getCharacterEncoding();
>             // Setting content type
>             res.setContentType("text/html; charset=" + encoding);
>             // Getting the OutputStream (just to be able to close it)
>             OutputStream out = res.getOutputStream();
>             // Sending the redirect
>             res.sendRedirect(Configuration.getDEFAULT_MAINPAGE());
>             // close output stream
>             out.close();
>         }
>         catch (IOException e) {
>             throw new ServerException("Got IOException while trying to
> redirect user to ["+Configuration.getDEFAULT_MAINPAGE()+"].", e);
>         }
>
>
> Why is that? Why do I have to get the outputstream, and then just close it
> to get the sendRedirect away? Why isn't the stream closed on exit of the
> doGet/Post method? Or whatever?

The default servlet doesn't use the output stream at all, and appears to
behave correctly (verified using a telnet session). This looks like a
problem with the HTTP client you're using.

Remy


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to