AsyncContext and I/O error handling (when peer disconnects)
问题 I'm implementing Server-Sent Events using Servlet 3.0's javax.servlet.AsyncContext interface. However I can't understand how I should handle I/O errors like peer disconnect. For a given AsyncContext ac = request.startAsync() , I can call ac.getResponse().getWriter().print(something) and then ac.getResponse.getWriter().flush() and it works fine. However when a client disconnects, I don't get an error - even if I attach a listener, its onError method is not called. I tested it with both Jetty 8