public void doGet(HttpServletRequest req, HttpServletResponse resp) { WebRequest wr = null; try { wr = WebRequest.getOrCreate(req, resp, null); handleRequest(wr); wr.flush(); } catch (Exception e) { try { if (wr != null) { wr.write("<html><body>"); wr.write("\n<h3>Exception</h3><p>"); wr.writeHtml(e.toString()); wr.write("</p>\n<p>getRequestURI: "); wr.writeHtml(wr.req.getRequestURI()); wr.write("</p>\n<p>getContextPath: "); wr.writeHtml(wr.req.getContextPath()); wr.write("</p>\n<p>getServletPath: "); wr.writeHtml(wr.req.getServletPath()); wr.write("</p>\n<pre>\n"); e.printStackTrace(new PrintWriter(wr.w)); wr.write("\n</pre>\n</body></html>"); wr.flush(); } } catch (Exception exx) { // can't do anything about this. } } }