Class Http2ConnectionWriter
java.lang.Object
io.helidon.http.http2.Http2ConnectionWriter
- All Implemented Interfaces:
Http2StreamWriter
HTTP/2 connection writer.
-
Constructor Summary
ConstructorsConstructorDescriptionHttp2ConnectionWriter(SocketContext ctx, DataWriter writer, List<Http2FrameListener> sendFrameListeners) A new writer. -
Method Summary
Modifier and TypeMethodDescriptionbooleantryWrite(Http2FrameData frame, Runnable beforeWrite) Attempts to write a frame without waiting for another frame write to finish.voidupdateHeaderTableSize(long newSize) Update header table size.voidwrite(Http2FrameData frame) Write a frame.voidwriteData(Http2FrameData frame, FlowControl.Outbound flowControl) Write a frame with flow control.intwriteData(Http2FrameData frame, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten) Write a frame with flow control and notify when anEND_STREAMdata frame has been written and accounted for.intwriteHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, FlowControl.Outbound flowControl) Write headers with no (or streaming) entity.intwriteHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten) Write headers and notify when anEND_STREAMheaders frame has been written.intwriteHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, Http2FrameData dataFrame, FlowControl.Outbound flowControl) Write headers and entity.intwriteHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, Http2FrameData dataFrame, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten) Write headers and entity, and notify when anEND_STREAMdata frame has been written and accounted for.
-
Constructor Details
-
Http2ConnectionWriter
public Http2ConnectionWriter(SocketContext ctx, DataWriter writer, List<Http2FrameListener> sendFrameListeners) A new writer.- Parameters:
ctx- connection contextwriter- data writersendFrameListeners- send frame listeners
-
-
Method Details
-
write
Description copied from interface:Http2StreamWriterWrite a frame.- Specified by:
writein interfaceHttp2StreamWriter- Parameters:
frame- frame to write
-
tryWrite
Attempts to write a frame without waiting for another frame write to finish.- Parameters:
frame- frame to writebeforeWrite- action to invoke after acquiring the frame serialization lock and before writing- Returns:
trueif the frame was written,falseif another frame write is in progress
-
writeData
Description copied from interface:Http2StreamWriterWrite a frame with flow control.- Specified by:
writeDatain interfaceHttp2StreamWriter- Parameters:
frame- data frameflowControl- outbound flow control
-
writeData
public int writeData(Http2FrameData frame, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten) Write a frame with flow control and notify when anEND_STREAMdata frame has been written and accounted for.- Parameters:
frame- data frameflowControl- outbound flow controlonEndStreamFrameWritten- action to run after theEND_STREAMdata frame is written and accounted for- Returns:
- number of bytes written
-
writeHeaders
public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, FlowControl.Outbound flowControl) Description copied from interface:Http2StreamWriterWrite headers with no (or streaming) entity.- Specified by:
writeHeadersin interfaceHttp2StreamWriter- Parameters:
headers- headersstreamId- stream IDflags- flags to useflowControl- flow control- Returns:
- number of bytes written
-
writeHeaders
public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten) Write headers and notify when anEND_STREAMheaders frame has been written.- Parameters:
headers- headersstreamId- stream IDflags- flags to useflowControl- flow controlonEndStreamFrameWritten- action to run after theEND_STREAMheaders frame is written- Returns:
- number of bytes written
-
writeHeaders
public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, Http2FrameData dataFrame, FlowControl.Outbound flowControl) Description copied from interface:Http2StreamWriterWrite headers and entity.- Specified by:
writeHeadersin interfaceHttp2StreamWriter- Parameters:
headers- headersstreamId- stream IDflags- header flagsdataFrame- data frameflowControl- flow control- Returns:
- number of bytes written
-
writeHeaders
public int writeHeaders(Http2Headers headers, int streamId, Http2Flag.HeaderFlags flags, Http2FrameData dataFrame, FlowControl.Outbound flowControl, Runnable onEndStreamFrameWritten) Write headers and entity, and notify when anEND_STREAMdata frame has been written and accounted for.- Parameters:
headers- headersstreamId- stream IDflags- header flagsdataFrame- data frameflowControl- flow controlonEndStreamFrameWritten- action to run after theEND_STREAMdata frame is written and accounted for- Returns:
- number of bytes written
-
updateHeaderTableSize
Update header table size.- Parameters:
newSize- in bytes- Throws:
InterruptedException- in case we fail to lock on the stream
-