Module io.netty.codec.http2
Package io.netty5.handler.codec.http2
Interface Http2Connection.Endpoint<F extends Http2FlowController>
-
- Enclosing interface:
- Http2Connection
public static interface Http2Connection.Endpoint<F extends Http2FlowController>
A view of the connection from one endpoint (local or remote).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
allowPushTo()
This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint.void
allowPushTo(boolean allow)
This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint.boolean
canOpenStream()
Indicates whether or a stream created by this endpoint can be opened without violatingmaxActiveStreams()
.boolean
created(Http2Stream stream)
Indicates whether or not this endpoint created the given stream.Http2Stream
createStream(int streamId, boolean halfClosed)
Creates a stream initiated by this endpoint.F
flowController()
Gets the flow controller for this endpoint.void
flowController(F flowController)
Sets the flow controller for this endpoint.int
incrementAndGetNextStreamId()
Increment and get the next generated stream id this endpoint.boolean
isServer()
Indicates whether or not this endpoint is the server-side of the connection.boolean
isValidStreamId(int streamId)
Indicates whether the given streamId is from the set of IDs used by this endpoint to create new streams.int
lastStreamCreated()
Gets the ID of the stream last successfully created by this endpoint.int
lastStreamKnownByPeer()
If a GOAWAY was received for this endpoint, this will be the last stream ID from the GOAWAY frame.int
maxActiveStreams()
Gets the maximum number of streams (created by this endpoint) that are allowed to be active at the same time.void
maxActiveStreams(int maxActiveStreams)
Sets the limit forSETTINGS_MAX_CONCURRENT_STREAMS
.boolean
mayHaveCreatedStream(int streamId)
Indicates whether or not this endpoint may have created the given stream.int
numActiveStreams()
Gets the number of active streams (i.e.Http2Connection.Endpoint<? extends Http2FlowController>
opposite()
Gets theHttp2Connection.Endpoint
opposite this one.Http2Stream
reservePushStream(int streamId, Http2Stream parent)
Creates a push stream in the reserved state for this endpoint and notifies all listeners.
-
-
-
Method Detail
-
incrementAndGetNextStreamId
int incrementAndGetNextStreamId()
Increment and get the next generated stream id this endpoint. If negative, the stream IDs are exhausted for this endpoint an no further streams may be created.
-
isValidStreamId
boolean isValidStreamId(int streamId)
Indicates whether the given streamId is from the set of IDs used by this endpoint to create new streams.
-
mayHaveCreatedStream
boolean mayHaveCreatedStream(int streamId)
Indicates whether or not this endpoint may have created the given stream. This istrue
ifisValidStreamId(int)
andstreamId
<=lastStreamCreated()
.
-
created
boolean created(Http2Stream stream)
Indicates whether or not this endpoint created the given stream.
-
canOpenStream
boolean canOpenStream()
Indicates whether or a stream created by this endpoint can be opened without violatingmaxActiveStreams()
.
-
createStream
Http2Stream createStream(int streamId, boolean halfClosed) throws Http2Exception
Creates a stream initiated by this endpoint. This could fail for the following reasons:- The requested stream ID is not the next sequential ID for this endpoint.
- The stream already exists.
canOpenStream()
isfalse
.- The connection is marked as going away.
The initial state of the stream will be immediately set before notifying
Http2Connection.Listener
s. The state transition is sensitive tohalfClosed
and is defined byHttp2Stream.open(boolean)
.- Parameters:
streamId
- The ID of the streamhalfClosed
- seeHttp2Stream.open(boolean)
.- Throws:
Http2Exception
- See Also:
Http2Stream.open(boolean)
-
reservePushStream
Http2Stream reservePushStream(int streamId, Http2Stream parent) throws Http2Exception
Creates a push stream in the reserved state for this endpoint and notifies all listeners. This could fail for the following reasons:- Server push is not allowed to the opposite endpoint.
- The requested stream ID is not the next sequential stream ID for this endpoint.
- The number of concurrent streams is above the allowed threshold for this endpoint.
- The connection is marked as going away.
- The parent stream ID does not exist or is not
OPEN
from the side sending the push promise. - Could not set a valid priority for the new stream.
- Parameters:
streamId
- the ID of the push streamparent
- the parent stream used to initiate the push stream.- Throws:
Http2Exception
-
isServer
boolean isServer()
Indicates whether or not this endpoint is the server-side of the connection.
-
allowPushTo
void allowPushTo(boolean allow)
This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint. This method should only be called by Netty (not users) as a result of a receiving aSETTINGS
frame.
-
allowPushTo
boolean allowPushTo()
This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint. The initial value must betrue
for the client endpoint and always false for a server endpoint.
-
numActiveStreams
int numActiveStreams()
Gets the number of active streams (i.e.OPEN
orHALF CLOSED
) that were created by this endpoint.
-
maxActiveStreams
int maxActiveStreams()
Gets the maximum number of streams (created by this endpoint) that are allowed to be active at the same time. This is the SETTINGS_MAX_CONCURRENT_STREAMS value sent from the opposite endpoint to restrict stream creation by this endpoint.The default value returned by this method must be "unlimited".
-
maxActiveStreams
void maxActiveStreams(int maxActiveStreams)
Sets the limit forSETTINGS_MAX_CONCURRENT_STREAMS
.- Parameters:
maxActiveStreams
- The maximum number of streams (created by this endpoint) that are allowed to be active at once. This is the SETTINGS_MAX_CONCURRENT_STREAMS value sent from the opposite endpoint to restrict stream creation by this endpoint.
-
lastStreamCreated
int lastStreamCreated()
Gets the ID of the stream last successfully created by this endpoint.
-
lastStreamKnownByPeer
int lastStreamKnownByPeer()
If a GOAWAY was received for this endpoint, this will be the last stream ID from the GOAWAY frame. Otherwise, this will be-1
.
-
flowController
F flowController()
Gets the flow controller for this endpoint.
-
flowController
void flowController(F flowController)
Sets the flow controller for this endpoint.
-
opposite
Http2Connection.Endpoint<? extends Http2FlowController> opposite()
Gets theHttp2Connection.Endpoint
opposite this one.
-
-