Package io.netty.handler.codec.http2
Class DefaultHttp2ConnectionEncoder.FlowControlledHeaders
- java.lang.Object
-
- io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.FlowControlledBase
-
- io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.FlowControlledHeaders
-
- All Implemented Interfaces:
ChannelFutureListener,Http2RemoteFlowController.FlowControlled,GenericFutureListener<ChannelFuture>,java.util.EventListener
- Enclosing class:
- DefaultHttp2ConnectionEncoder
private final class DefaultHttp2ConnectionEncoder.FlowControlledHeaders extends DefaultHttp2ConnectionEncoder.FlowControlledBase
Wrap headers so they can be written subject to flow-control. While headers do not have cost against the flow-control window their order with respect to other frames must be maintained, hence if a DATA frame is blocked on flow-control a HEADER frame must wait until this frame has been written.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanexclusiveprivate booleanhasPriortyprivate Http2Headersheadersprivate intstreamDependencyprivate shortweight-
Fields inherited from class io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.FlowControlledBase
endOfStream, padding, promise, stream
-
Fields inherited from interface io.netty.channel.ChannelFutureListener
CLOSE, CLOSE_ON_FAILURE, FIRE_EXCEPTION_ON_FAILURE
-
-
Constructor Summary
Constructors Constructor Description FlowControlledHeaders(Http2Stream stream, Http2Headers headers, boolean hasPriority, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream, ChannelPromise promise)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderror(ChannelHandlerContext ctx, java.lang.Throwable cause)Called to indicate that an error occurred before this object could be completely written.booleanmerge(ChannelHandlerContext ctx, Http2RemoteFlowController.FlowControlled next)Merge the contents of thenextmessage into this message so they can be written out as one unit.intsize()The size of the payload in terms of bytes applied to the flow-control window.voidwrite(ChannelHandlerContext ctx, int allowedBytes)Writes up toallowedBytesof the encapsulated payload to the stream.-
Methods inherited from class io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder.FlowControlledBase
operationComplete, writeComplete
-
-
-
-
Field Detail
-
headers
private final Http2Headers headers
-
hasPriorty
private final boolean hasPriorty
-
streamDependency
private final int streamDependency
-
weight
private final short weight
-
exclusive
private final boolean exclusive
-
-
Constructor Detail
-
FlowControlledHeaders
FlowControlledHeaders(Http2Stream stream, Http2Headers headers, boolean hasPriority, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream, ChannelPromise promise)
-
-
Method Detail
-
size
public int size()
Description copied from interface:Http2RemoteFlowController.FlowControlledThe size of the payload in terms of bytes applied to the flow-control window. Some payloads likeHEADERframes have no cost against flow control and would return 0 for this value even though they produce a non-zero number of bytes on the wire. Other frames likeDATAframes have both their payload and padding count against flow-control.
-
error
public void error(ChannelHandlerContext ctx, java.lang.Throwable cause)
Description copied from interface:Http2RemoteFlowController.FlowControlledCalled to indicate that an error occurred before this object could be completely written.The
Http2RemoteFlowControllerwill make exactly one call to either this method orHttp2RemoteFlowController.FlowControlled.writeComplete().- Parameters:
ctx- The context to use if any communication needs to occur as a result of the error. This may benullif an exception occurs when the connection has not been established yet.cause- of the error.
-
write
public void write(ChannelHandlerContext ctx, int allowedBytes)
Description copied from interface:Http2RemoteFlowController.FlowControlledWrites up toallowedBytesof the encapsulated payload to the stream. Note that a value of 0 may be passed which will allow payloads with flow-control size == 0 to be written. The flow-controller may call this method multiple times with different values until the payload is fully written, i.e it's size after the write is 0.When an exception is thrown the
Http2RemoteFlowControllerwill make a call toHttp2RemoteFlowController.FlowControlled.error(ChannelHandlerContext, Throwable).- Parameters:
ctx- The context to use for writing.allowedBytes- an upper bound on the number of bytes the payload can write at this time.
-
merge
public boolean merge(ChannelHandlerContext ctx, Http2RemoteFlowController.FlowControlled next)
Description copied from interface:Http2RemoteFlowController.FlowControlledMerge the contents of thenextmessage into this message so they can be written out as one unit. This allows many small messages to be written as a single DATA frame.- Returns:
trueifnextwas successfully merged and does not need to be enqueued,falseotherwise.
-
-