You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dorel Vaida <Do...@ags.ro> on 2004/06/15 08:27:13 UTC

client disconnect

Hi all. I would like to know if in Tomcat there is something like
<ignore-client-disconnect> in resin. What I need, more specifically is
to catch and handle the exception when a client (browser) disconnects
during tomcat serving a request. It seems now that even if I close the
browser I CAN STILL write in the output stream of the response and even
flush it w/o geting an exception. Here's the simple example I'm using,
is a jsp:
 
<%@page import="java.io.*" %>

<%

while(true){

    try{

        out.write(" errrrr ");

        out.flush();

        System.out.println("output wrote");

        Thread.sleep(2000);

    } catch (Throwable t) {

        t.printStackTrace();

    }

}

%>

Sorry for the bad formatting. This sample code seems to work even after
I close the browser. No exception thrown when writing to an inexistent
client (?!)Which seems pretty unbelievable to me, that's why I'm asking,
I think that there is something that I miss badly here. 

I have tested with tomcat 5.18 and 5.25 on sun j2sdk_1.4.2_03/ Windows
XP.

Thanks in advance