Author: fhanik Date: Thu Apr 12 20:22:29 2007 New Revision: 528341 URL: http://svn.apache.org/viewvc?view=rev&rev=528341 Log: Updated with some useful info
Modified: tomcat/tc6.0.x/trunk/webapps/docs/aio.xml Modified: tomcat/tc6.0.x/trunk/webapps/docs/aio.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/aio.xml?view=diff&rev=528341&r1=528340&r2=528341 ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/aio.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/aio.xml Thu Apr 12 20:22:29 2007 @@ -72,7 +72,13 @@ Alternately, it is also possible to catch any exception, perform clean up on any data structure the servlet may be using, and using the close method of the event. It is not allowed to attempt reading data from the request - object outside of the execution of this method.</li> + object outside of the execution of this method.<br/> + On some platforms, like Windows, a client disconnect is indicated by a READ event. + Reading from the stream may result in -1, an IOException or an EOFException. + Make sure you properly handle all these three cases. + If you don't catch the IOException, Tomcat will instantly invoke your event chain with an ERROR as + it catches the error for you, and you will be notified of the error at that time. + </li> <li>EventType.END: End may be called to end the processing of the request. Fields that have been initialized in the begin method should be reset. After this event has been processed, the request and response objects, as well as all their dependent @@ -194,8 +200,8 @@ InputStream is = request.getInputStream(); byte[] buf = new byte[512]; do { - int n = is.read(buf); - if (n > 0) { + int n = is.read(buf); //can throw an IOException + if (n > 0) { log("Read " + n + " bytes: " + new String(buf, 0, n) + " for session: " + request.getSession(true).getId()); } else if (n < 0) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]