@Override public boolean tryWrite(HttpObject o) { if (o instanceof HttpHeaders) { // NB: It's safe to call logBuilder.start() multiple times. logBuilder.startResponse(); final HttpHeaders headers = (HttpHeaders) o; final HttpStatus status = headers.status(); if (status != null && status.codeClass() != HttpStatusClass.INFORMATIONAL) { logBuilder.responseHeaders(headers); } } else if (o instanceof HttpData) { logBuilder.increaseResponseLength(((HttpData) o).length()); } return delegate.tryWrite(o); }
logBuilder.responseHeaders(mutableHeaders); if (!contentAndTrailingHeadersEmpty) { future = responseEncoder.writeData(
ctx.logBuilder().responseHeaders(HttpHeaders.of(HttpStatus.OK)); ctx.logBuilder().responseFirstBytesTransferred(); ctx.logBuilder().responseContent(rpcRes, res);
logBuilder.responseHeaders(HttpHeaders.of(HttpStatus.OK)); logBuilder.responseFirstBytesTransferred(); logBuilder.responseContent(rpcRes, res);
private void failAndRespond(Throwable cause, AggregatedHttpMessage message, Http2Error error) { final HttpHeaders headers = message.headers(); final HttpData content = message.content(); logBuilder().responseHeaders(headers); logBuilder().increaseResponseLength(content.length()); final State oldState = setDone(); subscription.cancel(); final int id = req.id(); final int streamId = req.streamId(); final ChannelFuture future; if (wroteNothing(oldState)) { // Did not write anything yet; we can send an error response instead of resetting the stream. if (content.isEmpty()) { future = responseEncoder.writeHeaders(id, streamId, headers, true); } else { responseEncoder.writeHeaders(id, streamId, headers, false); future = responseEncoder.writeData(id, streamId, content, true); } } else { // Wrote something already; we have to reset/cancel the stream. future = responseEncoder.writeReset(id, streamId, error); } addCallbackAndFlush(cause, oldState, future); }
o = fillAdditionalHeaders(headers, additionalHeaders); logBuilder().responseHeaders(headers);
log.endRequest(); log.responseLength(128); log.responseHeaders(HttpHeaders.of(200).set(HttpHeaderNames.DATE, "some-date")); log.responseContent(RPC_RES, THRIFT_REPLY); log.endResponse();
log.endRequest(); log.responseLength(128); log.responseHeaders(HttpHeaders.of(200).set(HttpHeaderNames.DATE, "some-date")); log.responseContent(RPC_RES, THRIFT_REPLY); log.endResponse();