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

Class Http2OutputBuffer

java/org/apache/coyote/http2/Http2OutputBuffer.java:31–87  ·  view source on GitHub ↗

HTTP/2 output buffer that wraps a chain of OutputFilter instances and delegates to a StreamOutputBuffer.

Source from the content-addressed store, hash-verified

29 * {@link StreamOutputBuffer}.
30 */
31public class Http2OutputBuffer implements HttpOutputBuffer {
32
33 private final Response coyoteResponse;
34 private HttpOutputBuffer next;
35
36
37 /**
38 * Add a filter at the start of the existing processing chain. Subsequent calls to the {@link HttpOutputBuffer}
39 * methods of this object will be passed to the filter. If appropriate, the filter will then call the same method on
40 * the next HttpOutputBuffer in the chain until the call reaches the StreamOutputBuffer.
41 *
42 * @param filter The filter to add to the start of the processing chain
43 */
44 public void addFilter(OutputFilter filter) {
45 filter.setBuffer(next);
46 next = filter;
47 }
48
49
50 /**
51 * Creates the output buffer.
52 *
53 * @param coyoteResponse The Coyote response
54 * @param streamOutputBuffer The underlying stream output buffer
55 */
56 public Http2OutputBuffer(Response coyoteResponse, StreamOutputBuffer streamOutputBuffer) {
57 this.coyoteResponse = coyoteResponse;
58 this.next = streamOutputBuffer;
59 }
60
61
62 @Override
63 public int doWrite(ByteBuffer chunk) throws IOException {
64 if (!coyoteResponse.isCommitted()) {
65 coyoteResponse.commit();
66 }
67 return next.doWrite(chunk);
68 }
69
70
71 @Override
72 public long getBytesWritten() {
73 return next.getBytesWritten();
74 }
75
76
77 @Override
78 public void end() throws IOException {
79 next.end();
80 }
81
82
83 @Override
84 public void flush() throws IOException {
85 next.flush();
86 }
87}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected