问题是:
ac.getResponse.getWriter().flush()不抛出
IOException
因此,为了获得有关I / O操作的错误通知,您需要使用
ServletOutputStream:
try { ServletOutputStream out = ac.getResponse().getOutputStream(); out.print(stuff); out.flush(); // throws IOException}catch(IOException e) { // handle a error}


