protected void fireAfterAll(final Request req, final Response resp) { try { fireAccessHook( new AccessHookCallback() { @Override public void callHook(AccessHook hook) { hook.afterAll(req, resp); } }); } catch (Exception e) { L.warn(null, e, "fireAfterAll error"); } }
protected void fireExceptionCaught(final Request req, final Response resp, final Throwable t) { try { fireAccessHook( new AccessHookCallback() { @Override public void callHook(AccessHook hook) { hook.exceptionCaught(req, resp, t); } }); } catch (Exception e) { L.warn(null, e, "fireExceptionCaught error"); } }
protected void process(HttpServletRequest hreq, HttpServletResponse hresp) throws ServletException, IOException { Request req = createRequest(hreq, hresp); if (L.isDebugEnabled()) L.debug(null, req.toString()); Response resp = createResponse(hreq, hresp); try { fireBeforeAll(req, resp); if (routeSummary && "$" .equals(StringUtils.removeStart(StringUtils.trimToEmpty(hreq.getPathInfo()), "/"))) { resp.body(RawText.of(makeRouteSummary())); resp.type("text/plain"); } else { invokeAllMatched(before, req, resp); boolean matched = invokeFirstMatched(routes, req, resp); invokeAllMatched(after, req, resp); if (!matched) TopazHelper.halt(404, "Route error"); if (L.isDebugEnabled()) L.debug(null, "ok"); } fireSuccess(req, resp); } catch (Throwable t) { fireExceptionCaught(req, resp, t); Throwable c = (t instanceof InvocationTargetException) ? ((InvocationTargetException) t).getTargetException() : t; if (!(c instanceof QuietHaltException)) resp.error(c); L.warn(null, c, "error"); } finally { fireBeforeOutput(req, resp); resp.doOutput(Response.OutputOptions.fromRequest(req)); fireAfterOutput(req, resp); req.deleteUploadedFiles(); fireAfterAll(req, resp); if (L.isDebugEnabled()) L.debug(null, "complete"); } }