HttpServletRequest request = getCauchoRequest();
request.setAttribute("javax.servlet.jsp.jspException", e);
CauchoResponse response = getCauchoResponse();
response.setForbidForward(false);
response.setResponseStream(_responseStream);
response.killCache();
response.setNoCache(true);
if (e instanceof ClientDisconnectException)
throw (ClientDisconnectException) e;
if (! (_servlet instanceof Page)) {
}
else if (getApplication() == null
|| getApplication().getJsp() == null
|| ! getApplication().getJsp().isRecompileOnError()) {
}
else if (e instanceof OutOfMemoryError) {
}
else if (e instanceof Error) {
try {
Path workDir = getApplication().getRootDirectory().lookup("WEB-INF/work");
String className = _servlet.getClass().getName();
Path path = workDir.lookup(className.replace('.', '/') + ".class");
log.warning("Removing " + path + " due to " + e);
path.remove();
} catch (Exception e1) {
}
Page page = (Page) _servlet;
page._caucho_unload();
if (! page.isDead()) {
page.setDead();
page.destroy();
}
}
_topOut.clearBuffer();
if (_errorPage != null) {
if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, e.toString(), e);
}
else if (e instanceof DisplayableException) {
log.warning(e.getMessage());
}
else {
log.log(Level.WARNING, e.toString(), e);
}
request.setAttribute(EXCEPTION, e);
request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,
response.getStatus());
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e);
request.setAttribute(RequestDispatcher.ERROR_MESSAGE, e.getMessage());
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE,
e.getClass());
request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI,
request.getRequestURI());
// jsp/01ck
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
try {
RequestDispatcher rd = getCauchoRequest().getRequestDispatcher(_errorPage);
if (rd instanceof RequestDispatcherImpl) {
getCauchoResponse().setHasError(true);
((RequestDispatcherImpl) rd).error(getCauchoRequest(), getCauchoResponse());
}
else {
if (rd != null) {
getCauchoResponse().killCache();
getCauchoResponse().setNoCache(true);
rd.forward(getCauchoRequest(), getCauchoResponse());
}
else {
log.log(Level.FINE, e.toString(), e);
throw new ServletException(L.l("`{0}' is an unknown error page. The JSP errorPage directive must refer to a valid URL relative to the current web-app.",
_errorPage));
}
}
// jsp/01ck
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (FileNotFoundException e2) {
log.log(Level.WARNING, e.toString(), e2);
throw new ServletException(L.l("`{0}' is an unknown error page. The JSP errorPage directive must refer to a valid URL relative to the current web-app.",
_errorPage));
} catch (IOException e2) {