private void checkStreamingPreconditions() { U.must(result() == null, "The response result has already been set, so cannot write the response through OutputStream, too!"); U.must(body() == null, "The response body has already been set, so cannot write the response through OutputStream, too!"); U.must(raw() == null, "The raw response has already been set, so cannot write the response through OutputStream, too!"); }
private String validateResponse() { if (response == null) { return "Response wasn't provided!"; } if (response.result() == null && response.body() == null && response.redirect() == null && response.file() == null && response.raw() == null && !response().mvc()) { return "Response content wasn't provided!"; } if (response.contentType() == null && response.raw() == null) { return "Response content type wasn't provided!"; } return null; }
private static RespBody createRespBodyFromResult(Req req, RespImpl resp) { Object result = resp.result(); Object body = resp.body(); if (result instanceof RespBody) { return (RespBody) result; } else if (body instanceof RespBody) { return (RespBody) body; } else if (resp.mvc()) { byte[] bytes = ResponseRenderer.renderMvc((ReqImpl) req, resp); HttpUtils.postProcessResponse(resp); // the response might have been changed, so post-process again return new RespBodyBytes(bytes); } else if (body != null) { return new RespBodyBytes(Msc.toBytes(body)); } else if (result != null) { return resultToRespBody(resp, result); } else { throw U.rte("There's nothing to render!"); } }
private void checkStreamingPreconditions() { U.must(result() == null, "The response result has already been set, so cannot write the response through OutputStream, too!"); U.must(body() == null, "The response body has already been set, so cannot write the response through OutputStream, too!"); U.must(raw() == null, "The raw response has already been set, so cannot write the response through OutputStream, too!"); }
private String validateResponse() { if (response == null) { return "Response wasn't provided!"; } if (response.result() == null && response.body() == null && response.redirect() == null && response.file() == null && response.raw() == null && !response().mvc()) { return "Response content wasn't provided!"; } if (response.contentType() == null && response.raw() == null) { return "Response content type wasn't provided!"; } return null; }
private static RespBody createRespBodyFromResult(Req req, RespImpl resp) { Object result = resp.result(); Object body = resp.body(); if (result instanceof RespBody) { return (RespBody) result; } else if (body instanceof RespBody) { return (RespBody) body; } else if (resp.mvc()) { byte[] bytes = ResponseRenderer.renderMvc((ReqImpl) req, resp); HttpUtils.postProcessResponse(resp); // the response might have been changed, so post-process again return new RespBodyBytes(bytes); } else if (body != null) { return new RespBodyBytes(Msc.toBytes(body)); } else if (result != null) { return resultToRespBody(resp, result); } else { throw U.rte("There's nothing to render!"); } }