If you write a servlet and add it to the servlet pipeline, note that your servlet’s service method will get called for all requests that reach this stage in the pipeline. If your servlet does not call the passRequest() method (perhaps because an application exception is thrown), then no content will reach the browser and the likely result will be a “document contains no data” message from the browser. Make sure your servlets are coded properly to avoid this problem.

Your servlet (whether it appears in the servlet pipeline or not) should generally not catch IOExceptions that occur when writing to the ServletOutputStream, since those exceptions indicate that the user has clicked the browser’s stop button. If you need to execute some code when the user clicks the stop button, then your code should catch the IOException, do any needed processing, and then re-throw the IOException.

 
loading table of contents...