HttpServletResponse res = (HttpServletResponse) response;
FileNotFoundException notFound = null;
SoftReference<Page> pageRef = _pageRef;
Page page;
if (pageRef != null)
page = pageRef.get();
else
page = null;
if (page == null || page._caucho_isModified()) {
try {
_pageRef = null;
page = compilePage(page, req, res);
if (page != null) {
_pageRef = new SoftReference<Page>(page);
_isSingleThread = page instanceof SingleThreadModel;
}
} catch (FileNotFoundException e) {
page = null;
notFound = e;
}
}
if (page == null) {
// jsp/01cg
if (notFound == null)
return;
String errorUri = (String) req.getAttribute(RequestDispatcher.ERROR_REQUEST_URI);
String uri = (String) req.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI);
String forward = (String) req.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
// jsp/01ch
if (uri != null) {
//throw new FileNotFoundException(uri);
throw notFound;
}
else if (forward != null) {
//throw new FileNotFoundException(req.getRequestURI());
throw notFound;
}
else if (errorUri != null) {
//throw new FileNotFoundException(errorUri);
throw notFound;
}
else {
log.log(Level.FINER, notFound.toString(), notFound);
}
((HttpServletResponse) res).sendError(HttpServletResponse.SC_NOT_FOUND);
}
else if (req instanceof HttpServletRequest) {
try {
if (_isSingleThread) {
synchronized (page) {
page.pageservice(req, res);
}
}
else
page.pageservice(req, res);
} catch (ServletException e) {
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e);
if (_config != null)
request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME,
_config.getServletName());