tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Endre StĂžlsvik <>
Subject [TC4] Sending redirect fails if OutputStream isn't closed ..
Date Mon, 12 Nov 2001 09:34:25 GMT
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 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
            // close output stream
        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?


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message