HttpStatus errorAndDone(final Req req, final Throwable error, final LogLevel logLevel) { req.revert(); req.async(); Runnable errorHandler = () -> { error(req, error, logLevel); // the Req object will do the rendering req.done(); }; Ctx ctx = Ctxs.get(); if (ctx == null) { With.exchange(req).run(errorHandler); } else { Jobs.execute(errorHandler); } return HttpStatus.ASYNC; }
private void execHandlerJob(final Channel channel, final boolean isKeepAlive, final MediaType contentType, final Req req) { With.tag(CTX_TAG_HANDLER).exchange(req).run(() -> { try { req.response() .view(options.view()) .contentType(options.contentType()) .mvc(options.mvc()); handleWithWrappers(channel, isKeepAlive, contentType, req, wrappers.get()); } catch (Throwable e) { handleError(req, e); } }); }
private void execHandlerJob(final Channel channel, final boolean isKeepAlive, final MediaType contentType, final Req req) { With.tag(CTX_TAG_HANDLER).exchange(req).run(new Runnable() { @Override public void run() { try { req.response() .view(options.view()) .contentType(options.contentType()) .mvc(options.mvc()); handleWithWrappers(channel, isKeepAlive, contentType, req, wrappers.get()); } catch (Throwable e) { handleError(req, e); } } }); }
HttpStatus errorAndDone(final Req req, final Throwable error, final LogLevel logLevel) { req.revert(); req.async(); Runnable errorHandler = new Runnable() { @Override public void run() { error(req, error, logLevel); // the Req object will do the rendering req.done(); } }; Ctx ctx = Ctxs.get(); if (ctx == null) { With.exchange(req).run(errorHandler); } else { Jobs.execute(errorHandler); } return HttpStatus.ASYNC; }