void writeResponse(final MaybeReq req, final Channel ctx, final boolean isKeepAlive, final int code, final MediaType contentType, final byte[] content) { startResponse(respOrNull(req), ctx, code, isKeepAlive, contentType); writeContentLengthAndBody(req, ctx, content); }
@SuppressWarnings("unused") private void writeOnBufferAsJson(MaybeReq req, Channel ctx, int code, boolean isKeepAlive, Object value) { startResponse(respOrNull(req), ctx, code, isKeepAlive, MediaType.JSON); Buf output = ctx.output(); synchronized (output) { writeJsonBody(req, output.unwrap(), value); } }
startResponse(null, channel, code, isKeepAlive, contentType);
private void writeJsonResponse(MaybeReq req, Resp resp, Channel ctx, boolean isKeepAlive, int code, MediaType contentType, Object result) { startResponse(resp, ctx, code, isKeepAlive, contentType); RapidoidThreadLocals locals = Msc.locals(); ReusableWritable out = locals.jsonRenderingStream(); // FIXME headers JSON.stringify(result, out); writeContentLengthHeader(ctx, out.size()); closeHeaders(req, ctx.output()); ctx.write(out.array(), 0, out.size()); }
void writeResponse(final MaybeReq req, final Channel ctx, final boolean isKeepAlive, final int code, final MediaType contentType, final byte[] content) { startResponse(respOrNull(req), ctx, code, isKeepAlive, contentType); writeContentLengthAndBody(req, ctx, content); }
@SuppressWarnings("unused") private void writeOnBufferAsJson(MaybeReq req, Channel ctx, int code, boolean isKeepAlive, Object value) { startResponse(respOrNull(req), ctx, code, isKeepAlive, MediaType.JSON); Buf output = ctx.output(); synchronized (output) { writeJsonBody(req, output.unwrap(), value); } }
startResponse(null, channel, code, isKeepAlive, contentType);
private void writeJsonResponse(MaybeReq req, Resp resp, Channel ctx, boolean isKeepAlive, int code, MediaType contentType, Object result) { startResponse(resp, ctx, code, isKeepAlive, contentType); RapidoidThreadLocals locals = Msc.locals(); ReusableWritable out = locals.jsonRenderingStream(); // FIXME headers JSON.stringify(result, out); writeContentLengthHeader(ctx, out.size()); closeHeaders(req, ctx.output()); ctx.write(out.array(), 0, out.size()); }