tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fang Yidong <>
Subject Re: How can I get notified when the HTTP client close the connection?
Date Fri, 23 May 2003 09:33:05 GMT
Tim,I'm so confused as you.
In fact,I'm developing a download management system,one component of which is the servlet
like this:
public class MyServlet extends HttpServlet{
public doGet(...){
   OutputStream out=response.getOutputStream();
}//class MyServlet
Since the data may be large,the client may abort the data transportation during the "while"
cycles,then an IOException would be expected when the servlet retry out.write(<data>).But
the truth is that there isn't any exception raised when out.write(<data>).The data seems
to be discarded silently and the servlet can not see anything abnormal,so the servlet thread
won't exit until it finished to "write" all of the data the output stream "out",which now
points to a null device.
It seems that this problem is relevant to the implementation of the web container.Should the
developers of Tomcat or the editor of the servlet specification be aware of it?
Tim wrote:
>After a quick glance at the spec, I don't see any place which states 
>server must throw an exception on client abort. There is a reference in
>ServletOutputStream throwing IOExceptions but it is very vague.
>Try the same code in a servlet and see what happens. (I don't know if 
>it will
>be helpful or not)
>Fang Yidong wrote:
>> The problem is: I can't catch any Exception at all.
>> Tim wote:

Do You Yahoo!?
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message