private static HttpHeaders toResponseHeaders(ArmeriaHttpTransport transport) { final MetaData.Response info = transport.info; if (info == null) { throw new IllegalStateException("response metadata unavailable"); } final HttpHeaders headers = HttpHeaders.of(HttpStatus.valueOf(info.getStatus())); info.getFields().forEach(e -> headers.add(HttpHeaderNames.of(e.getName()), e.getValue())); if (transport.method != HttpMethod.HEAD) { headers.setLong(HttpHeaderNames.CONTENT_LENGTH, transport.contentLength); } return headers; }
private void generateResponseLine(MetaData.Response response, ByteBuffer header) int status=response.getStatus(); PreparedResponse preprepared = status<__preprepared.length?__preprepared[status]:null; String reason=response.getReason();
private void generateResponseLine(MetaData.Response response, ByteBuffer header) int status=response.getStatus(); PreparedResponse preprepared = status<__preprepared.length?__preprepared[status]:null; String reason=response.getReason();
int status=info.getStatus(); if (status>=100 && status<200 )
buf.append("\" "); int status = response.getCommittedMetaData().getStatus(); if (status >=0)
int status=info.getStatus(); if (status>=100 && status<200 )
accessLogEntry.setDurationBetweenRequestResponse(endTime - startTime); accessLogEntry.setReturnedContentSize(response.getHttpChannel().getBytesWritten()); accessLogEntry.setStatusCode(response.getCommittedMetaData().getStatus());
int code=response.getStatus(); HttpField status = code<__status.length?__status[code]:null; if (status==null)
buf.append("\" "); logStatus(buf, response.getCommittedMetaData().getStatus()); buf.append(' ');
private void generateResponseLine(MetaData.Response response, ByteBuffer header) int status=response.getStatus(); PreparedResponse preprepared = status<__preprepared.length?__preprepared[status]:null; String reason=response.getReason();
final int status=info.getStatus(); final Callback committed = (status<200&&status>=100)?new Commit100Callback(callback):new CommitCallback(callback, content, complete);
protected boolean sendResponse(MetaData.Response info, ByteBuffer content, boolean complete, final Callback callback) { boolean committing = _committed.compareAndSet(false, true); if (committing) { // We need an info to commit if (info==null) info = _response.newResponseMetaData(); commit(info); // wrap callback to process 100 responses final int status=info.getStatus(); final Callback committed = (status<200&&status>=100)?new Commit100Callback(callback):new CommitCallback(callback); // committing write _transport.send(info, _request.isHead(), content, complete, committed); } else if (info==null) { // This is a normal write _transport.send(null,_request.isHead(), content, complete, callback); } else { callback.failed(new IllegalStateException("committed")); } return committing; }
@Override protected void commit(MetaData.Response info) { super.commit(info); if (LOG.isDebugEnabled()) { Stream stream = getStream(); LOG.debug("HTTP2 Commit Response #{}/{}:{}{} {} {}{}{}", stream.getId(), Integer.toHexString(stream.getSession().hashCode()), System.lineSeparator(), info.getHttpVersion(), info.getStatus(), info.getReason(), System.lineSeparator(), info.getFields()); } }
@Override public String toString() { HttpFields fields = getFields(); return String.format("%s{s=%d,h=%d,cl=%d}", getHttpVersion(), getStatus(), fields == null ? -1 : fields.size(), getContentLength()); } }
@Override public void log(Request request, Response response) { final int status = response.getCommittedMetaData().getStatus(); registry.meter(prefix + '.' + status + "-responses").mark(); if (wrapped != null) { wrapped.log(request, response); } } }
private void sendHeadersFrame(MetaData.Response info, boolean endStream, Callback callback) { if (LOG.isDebugEnabled()) { LOG.debug("HTTP2 Response #{}/{}:{}{} {}{}{}", stream.getId(), Integer.toHexString(stream.getSession().hashCode()), System.lineSeparator(), HttpVersion.HTTP_2, info.getStatus(), System.lineSeparator(), info.getFields()); } HeadersFrame frame = new HeadersFrame(stream.getId(), info, null, endStream); stream.headers(frame, callback); }
protected void commit (MetaData.Response info) { _committedMetaData=info; if (LOG.isDebugEnabled()) LOG.debug("COMMIT for {} on {}{}{} {} {}{}{}",getRequest().getRequestURI(),this,System.lineSeparator(), info.getStatus(),info.getReason(),info.getHttpVersion(),System.lineSeparator(), info.getFields()); }
@Override public String toString() { HttpFields fields = getFields(); return String.format("%s{s=%d,h=%d,cl=%d}", getHttpVersion(), getStatus(), fields == null ? -1 : fields.size(), getContentLength()); } }
@Override public String toString() { HttpFields fields = getFields(); return String.format("%s{s=%d,h=%d}", getVersion(), getStatus(), fields == null ? -1 : fields.size()); } }