MCPcopy Index your code
hub / github.com/apache/tomcat / writeTrailers

Method writeTrailers

java/org/apache/coyote/http2/Stream.java:635–667  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

633
634
635 final void writeTrailers() throws IOException {
636 Supplier<Map<String,String>> trailerFieldsSupplier = coyoteResponse.getTrailerFields();
637 if (trailerFieldsSupplier == null) {
638 // No supplier was set, end of stream will already have been sent
639 return;
640 }
641
642 /*
643 * Need a dedicated MimeHeaders for trailers as the MimeHeaders from the response needs to be retained in case
644 * the access log needs to log header values.
645 */
646 MimeHeaders mimeHeaders = new MimeHeaders();
647
648 Map<String,String> trailerFields = trailerFieldsSupplier.get();
649 if (trailerFields == null) {
650 trailerFields = Collections.emptyMap();
651 }
652
653 // Copy the contents of the Map to the MimeHeaders
654 // TODO: Is there benefit in refactoring this? Is MimeHeaders too
655 // heavyweight? Can we reduce the copy/conversions?
656 for (Map.Entry<String,String> trailerField : trailerFields.entrySet()) {
657 // Ignore disallowed headers
658 if (HeaderUtil.isHeaderDisallowedInTrailers(trailerField.getKey())) {
659 continue;
660 }
661
662 MessageBytes mb = mimeHeaders.addValue(trailerField.getKey());
663 mb.setString(trailerField.getValue());
664 }
665
666 handler.writeHeaders(this, mimeHeaders, true, Constants.DEFAULT_HEADERS_FRAME_SIZE);
667 }
668
669
670 final void writeAck() throws IOException {

Callers 1

endMethod · 0.80

Calls 9

addValueMethod · 0.95
setStringMethod · 0.95
getTrailerFieldsMethod · 0.65
getMethod · 0.65
getValueMethod · 0.65
entrySetMethod · 0.45
getKeyMethod · 0.45
writeHeadersMethod · 0.45

Tested by

no test coverage detected