private void handleWithWrappers(Channel channel, boolean isKeepAlive, MediaType contentType, Req req, HttpWrapper[] wrappers) { Object result; try { if (!U.isEmpty(wrappers)) { result = wrap(channel, isKeepAlive, req, 0, wrappers); } else { result = handleReqAndPostProcess(channel, isKeepAlive, req); } } catch (Throwable e) { result = e; } complete(channel, isKeepAlive, contentType, req, result); }
private void complete(Channel ctx, boolean isKeepAlive, MediaType contentType, Req req, Object result) { U.must(result != null, "The post-processed result cannot be null!"); U.must(!(result instanceof Req), "The post-processed result cannot be a Req instance!"); U.must(!(result instanceof Resp), "The post-processed result cannot be a Resp instance!"); if (result instanceof Throwable) { handleError(req, (Throwable) result); return; } if (result == HttpStatus.ERROR) { complete(ctx, isKeepAlive, contentType, req, U.rte("Handler error!")); return; } if (result == HttpStatus.NOT_FOUND) { http.notFound(ctx, isKeepAlive, contentType, handler, req); return; } if (result == HttpStatus.ASYNC) { return; } processNormalResult(req, result); }
private void handleWithWrappers(Channel channel, boolean isKeepAlive, MediaType contentType, Req req, HttpWrapper[] wrappers) { Object result; try { if (!U.isEmpty(wrappers)) { result = wrap(channel, isKeepAlive, req, 0, wrappers); } else { result = handleReqAndPostProcess(channel, isKeepAlive, req); } } catch (Throwable e) { result = e; } complete(channel, isKeepAlive, contentType, req, result); }
private void complete(Channel ctx, boolean isKeepAlive, MediaType contentType, Req req, Object result) { U.must(result != null, "The post-processed result cannot be null!"); U.must(!(result instanceof Req), "The post-processed result cannot be a Req instance!"); U.must(!(result instanceof Resp), "The post-processed result cannot be a Resp instance!"); if (result instanceof Throwable) { handleError(req, (Throwable) result); return; } if (result == HttpStatus.ERROR) { complete(ctx, isKeepAlive, contentType, req, U.rte("Handler error!")); return; } if (result == HttpStatus.NOT_FOUND) { http.notFound(ctx, isKeepAlive, contentType, handler, req); return; } if (result == HttpStatus.ASYNC) { return; } processNormalResult(req, result); }