Top Description Inners Methods
io.netty5.handler.codec.http2

public Interface Http2FrameWriter

extends Http2DataWriter, Closeable
Known Direct Subinterfaces
io.netty5.handler.codec.http2.Http2ConnectionEncoder
Known Direct Implementers
io.netty5.handler.codec.http2.Http2OutboundFrameLogger, io.netty5.handler.codec.http2.DecoratingHttp2FrameWriter, io.netty5.handler.codec.http2.DefaultHttp2FrameWriter
Annotations
@UnstableApi
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.http2.headers.Http2Headers, io.netty5.util.concurrent.Future, io.netty5.util.internal.UnstableApi, java.io.Closeable

A writer responsible for marshaling HTTP/2 frames to the channel. All of the write methods in this interface write to the context, but DO NOT FLUSH. To perform a flush, you must separately call ChannelHandlerContext#flush().

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.io.Closeable.close.

Closes this writer and frees any allocated resources.
public Http2FrameWriter.Configuration
configuration()

Get the configuration related elements for this Http2FrameWriter

public Future<Void>

Returns:

the future for the write.
writeFrame
(ChannelHandlerContext
the context to use for writing.
ctx
,
byte
the frame type identifier.
frameType
,
int
the stream for which to send the frame.
streamId
,
Http2Flags
the flags to write for this frame.
flags
,
Buffer
the payload to write for this frame. This will be released by this method.
payload
)

Generic write method for any HTTP/2 frame.

public Future<Void>

Returns:

the future for the write.
writeGoAway
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the last known stream of this endpoint.
lastStreamId
,
long
the error code, if the connection was abnormally terminated.
errorCode
,
Buffer
application-defined debug data. This will be released by this method.
debugData
)

Writes a GO_AWAY frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write. Section 10.5.1 states the following:
The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
If this call has modified the HPACK header state you MUST throw a connection error.

If this call has NOT modified the HPACK header state you are free to throw a stream error.

writeHeaders
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the stream for which to send the frame.
streamId
,
Http2Headers
the headers to be sent.
headers
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
indicates if this is the last frame to be sent for the stream.
endStream
)

Writes a HEADERS frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write. Section 10.5.1 states the following:
The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
If this call has modified the HPACK header state you MUST throw a connection error.

If this call has NOT modified the HPACK header state you are free to throw a stream error.

writeHeaders
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the stream for which to send the frame.
streamId
,
Http2Headers
the headers to be sent.
headers
,
int
the stream on which this stream should depend, or 0 if it should depend on the connection.
streamDependency
,
short
the weight for this stream.
weight
,
boolean
whether this stream should be the exclusive dependant of its parent.
exclusive
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
indicates if this is the last frame to be sent for the stream.
endStream
)

Writes a HEADERS frame with priority specified to the remote endpoint.

public Future<Void>

Returns:

the future for the write.
writePing
(ChannelHandlerContext
the context to use for writing.
ctx
,
boolean
indicates whether this is an ack of a PING frame previously received from the remote endpoint.
ack
,
long
the payload of the frame.
data
)

Writes a PING frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write.
writePriority
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the stream for which to send the frame.
streamId
,
int
the stream on which this stream should depend, or 0 if it should depend on the connection.
streamDependency
,
short
the weight for this stream.
weight
,
boolean
whether this stream should be the exclusive dependant of its parent.
exclusive
)

Writes a PRIORITY frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write. Section 10.5.1 states the following:
The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
If this call has modified the HPACK header state you MUST throw a connection error.

If this call has NOT modified the HPACK header state you are free to throw a stream error.

writePushPromise
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the stream for which to send the frame.
streamId
,
int
the ID of the promised stream.
promisedStreamId
,
Http2Headers
the headers to be sent.
headers
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
)

Writes a PUSH_PROMISE frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write.
writeRstStream
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the stream for which to send the frame.
streamId
,
long
the error code indicating the nature of the failure.
errorCode
)

Writes a RST_STREAM frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write.
writeSettings
(ChannelHandlerContext
the context to use for writing.
ctx
,
Http2Settings
the settings to be sent.
settings
)

Writes a SETTINGS frame to the remote endpoint.

public Future<Void>

Returns:

the future for the write.
writeSettingsAck
(ChannelHandlerContext
the context to use for writing.
ctx
)

Writes a SETTINGS acknowledgment to the remote endpoint.

public Future<Void>

Returns:

the future for the write.
writeWindowUpdate
(ChannelHandlerContext
the context to use for writing.
ctx
,
int
the stream for which to send the frame.
streamId
,
int
the number of bytes by which the local inbound flow control window is increasing.
windowSizeIncrement
)

Writes a WINDOW_UPDATE frame to the remote endpoint.

Inherited from io.netty5.handler.codec.http2.Http2DataWriter:
writeData

Method Detail

closeback to summary
public void close()

Redeclares java.io.Closeable.close.

Closes this writer and frees any allocated resources.

Annotations
@Override
configurationback to summary
public Http2FrameWriter.Configuration configuration()

Get the configuration related elements for this Http2FrameWriter

writeFrameback to summary
public Future<Void> writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, Buffer payload)

Generic write method for any HTTP/2 frame. This allows writing of non-standard frames.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

frameType:byte

the frame type identifier.

streamId:int

the stream for which to send the frame.

flags:Http2Flags

the flags to write for this frame.

payload:Buffer

the payload to write for this frame. This will be released by this method.

Returns:Future<Void>

the future for the write.

writeGoAwayback to summary
public Future<Void> writeGoAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode, Buffer debugData)

Writes a GO_AWAY frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

lastStreamId:int

the last known stream of this endpoint.

errorCode:long

the error code, if the connection was abnormally terminated.

debugData:Buffer

application-defined debug data. This will be released by this method.

Returns:Future<Void>

the future for the write.

writeHeadersback to summary
public Future<Void> writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endStream)

Writes a HEADERS frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

streamId:int

the stream for which to send the frame.

headers:Http2Headers

the headers to be sent.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endStream:boolean

indicates if this is the last frame to be sent for the stream.

Returns:Future<Void>

the future for the write. Section 10.5.1 states the following:

The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
If this call has modified the HPACK header state you MUST throw a connection error.

If this call has NOT modified the HPACK header state you are free to throw a stream error.

writeHeadersback to summary
public Future<Void> writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endStream)

Writes a HEADERS frame with priority specified to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

streamId:int

the stream for which to send the frame.

headers:Http2Headers

the headers to be sent.

streamDependency:int

the stream on which this stream should depend, or 0 if it should depend on the connection.

weight:short

the weight for this stream.

exclusive:boolean

whether this stream should be the exclusive dependant of its parent.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endStream:boolean

indicates if this is the last frame to be sent for the stream.

Returns:Future<Void>

the future for the write. Section 10.5.1 states the following:

The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
If this call has modified the HPACK header state you MUST throw a connection error.

If this call has NOT modified the HPACK header state you are free to throw a stream error.

writePingback to summary
public Future<Void> writePing(ChannelHandlerContext ctx, boolean ack, long data)

Writes a PING frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

ack:boolean

indicates whether this is an ack of a PING frame previously received from the remote endpoint.

data:long

the payload of the frame.

Returns:Future<Void>

the future for the write.

writePriorityback to summary
public Future<Void> writePriority(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive)

Writes a PRIORITY frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

streamId:int

the stream for which to send the frame.

streamDependency:int

the stream on which this stream should depend, or 0 if it should depend on the connection.

weight:short

the weight for this stream.

exclusive:boolean

whether this stream should be the exclusive dependant of its parent.

Returns:Future<Void>

the future for the write.

writePushPromiseback to summary
public Future<Void> writePushPromise(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding)

Writes a PUSH_PROMISE frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

streamId:int

the stream for which to send the frame.

promisedStreamId:int

the ID of the promised stream.

headers:Http2Headers

the headers to be sent.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

Returns:Future<Void>

the future for the write. Section 10.5.1 states the following:

The header block MUST be processed to ensure a consistent connection state, unless the connection is closed.
If this call has modified the HPACK header state you MUST throw a connection error.

If this call has NOT modified the HPACK header state you are free to throw a stream error.

writeRstStreamback to summary
public Future<Void> writeRstStream(ChannelHandlerContext ctx, int streamId, long errorCode)

Writes a RST_STREAM frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

streamId:int

the stream for which to send the frame.

errorCode:long

the error code indicating the nature of the failure.

Returns:Future<Void>

the future for the write.

writeSettingsback to summary
public Future<Void> writeSettings(ChannelHandlerContext ctx, Http2Settings settings)

Writes a SETTINGS frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

settings:Http2Settings

the settings to be sent.

Returns:Future<Void>

the future for the write.

writeSettingsAckback to summary
public Future<Void> writeSettingsAck(ChannelHandlerContext ctx)

Writes a SETTINGS acknowledgment to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

Returns:Future<Void>

the future for the write.

writeWindowUpdateback to summary
public Future<Void> writeWindowUpdate(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement)

Writes a WINDOW_UPDATE frame to the remote endpoint.

Parameters
ctx:ChannelHandlerContext

the context to use for writing.

streamId:int

the stream for which to send the frame.

windowSizeIncrement:int

the number of bytes by which the local inbound flow control window is increasing.

Returns:Future<Void>

the future for the write.

io.netty5.handler.codec.http2 back to summary

public Interface Http2FrameWriter.Configuration

Known Direct Implementers
io.netty5.handler.codec.http2.DefaultHttp2FrameWriter

Configuration specific to Http2FrameWriter

Method Summary

Modifier and TypeMethod and Description
public Http2FrameSizePolicy
public Http2HeadersEncoder.Configuration

Method Detail

frameSizePolicyback to summary
public Http2FrameSizePolicy frameSizePolicy()

Get the Http2FrameSizePolicy for this Http2FrameWriter

headersConfigurationback to summary
public Http2HeadersEncoder.Configuration headersConfiguration()

Get the Http2HeadersEncoder.Configuration for this Http2FrameWriter