public void doErrorDispatch(int sc, String error) throws IOException { writer = null; responseState = ResponseState.NONE; resetBuffer(); treatAsCommitted = false; final String location = servletContext.getDeployment().getErrorPages().getErrorLocation(sc); if (location != null) { RequestDispatcherImpl requestDispatcher = new RequestDispatcherImpl(location, servletContext); final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); try { requestDispatcher.error(servletRequestContext, servletRequestContext.getServletRequest(), servletRequestContext.getServletResponse(), exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getCurrentServlet().getManagedServlet().getServletInfo().getName(), error); } catch (ServletException e) { throw new RuntimeException(e); } } else if (error != null) { setContentType("text/html"); setCharacterEncoding("UTF-8"); if(servletContext.getDeployment().getDeploymentInfo().isEscapeErrorMessage()) { getWriter().write("<html><head><title>Error</title></head><body>" + escapeHtml(error) + "</body></html>"); } else { getWriter().write("<html><head><title>Error</title></head><body>" + error + "</body></html>"); } getWriter().close(); } responseDone(); }
info.setDisableCachingForSecuredPages(src.isDisableCachingForSecuredPages()); info.setExceptionHandler(src.getExceptionHandler()); info.setEscapeErrorMessage(src.isEscapeErrorMessage()); for (SessionListener e : src.getSessionListeners()) { info.addSessionListener(e);
info.setDisableCachingForSecuredPages(src.isDisableCachingForSecuredPages()); info.setExceptionHandler(src.getExceptionHandler()); info.setEscapeErrorMessage(src.isEscapeErrorMessage()); for (SessionListener e : src.getSessionListeners()) { info.addSessionListener(e);