void terminatingChunk() { resume(() -> { Buf out = req.channel().output(); out.append("0\r\n\r\n"); return true; }); }
@Override public void resume(AsyncLogic asyncLogic) { req.channel().resume(req.connectionId(), req.handle(), asyncLogic); }
public void chunk(final byte[] data, final int offset, final int length) { U.notNull(data, "data"); resume(() -> { Buf out = req.channel().output(); out.append(Integer.toHexString(length)); out.append("\r\n"); out.append(data, offset, length); out.append("\r\n"); req.channel().send(); return false; }); }
void done(Req req) { ReqImpl reqq = (ReqImpl) req; reqq.doneProcessing(); Channel channel = reqq.channel(); channel.send(); channel.closeIf(!reqq.isKeepAlive()); }
void closeHeaders(MaybeReq req, Buf out) { // finishing the headers out.append(CR_LF); ReqImpl reqq = (ReqImpl) req.getReqOrNull(); if (reqq != null) { U.must(reqq.channel().output() == out); reqq.onHeadersCompleted(); } }
private void serveCached(ReqImpl req, CachedResp resp) { Channel channel = req.channel(); req.cached(true); HttpIO.INSTANCE.respond(HttpUtils.req(req), channel, -1, -1, resp.statusCode, req.isKeepAlive(), resp.contentType, new RespBodyBuffer(resp.body.duplicate()), resp.headers, null); channel.send().closeIf(!req.isKeepAlive()); }
@Override public boolean resumeAsync() { Buf out = req.channel().output(); out.append("0\r\n\r\n"); return true; } });
@Override public void resume(AsyncLogic asyncLogic) { req.channel().resume(req.connectionId(), req.handle(), asyncLogic); }
void done(Req req) { ReqImpl reqq = (ReqImpl) req; reqq.doneProcessing(); Channel channel = reqq.channel(); channel.send(); channel.closeIf(!reqq.isKeepAlive()); }
void closeHeaders(MaybeReq req, Buf out) { // finishing the headers out.append(CR_LF); ReqImpl reqq = (ReqImpl) req.getReqOrNull(); if (reqq != null) { U.must(reqq.channel().output() == out); reqq.onHeadersCompleted(); } }
private void serveCached(ReqImpl req, CachedResp resp) { Channel channel = req.channel(); req.cached(true); HttpIO.INSTANCE.respond(HttpUtils.req(req), channel, -1, -1, resp.statusCode, req.isKeepAlive(), resp.contentType, new RespBodyBuffer(resp.body.duplicate()), resp.headers, null); channel.send().closeIf(!req.isKeepAlive()); }