Package io.netty.handler.codec.http3
Class Http3ServerPushStreamManager
- java.lang.Object
-
- io.netty.handler.codec.http3.Http3ServerPushStreamManager
-
public final class Http3ServerPushStreamManager extends java.lang.Object
A manager for push streams for a server. New push streams can be initiated using the variousnewPushStream
methods. It is required to add theChannelHandler
returned fromcontrolStreamListener()
to theQuicChannel
associated with this manager.
-
-
Constructor Summary
Constructors Constructor Description Http3ServerPushStreamManager(QuicChannel channel)
Creates a new instance.Http3ServerPushStreamManager(QuicChannel channel, int initialPushStreamsCountHint)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelInboundHandler
controlStreamListener()
AChannelInboundHandler
to be added to theQuicChannel
associated with thisHttp3ServerPushStreamManager
to listen to control stream frames.boolean
isPushAllowed()
Returnstrue
if server push is allowed at this point.Future<QuicStreamChannel>
newPushStream(long pushId, @Nullable ChannelHandler handler)
Returns a new HTTP/3 push-stream that will use the givenChannelHandler
to dispatchHttp3PushStreamFrame
s too.void
newPushStream(long pushId, @Nullable ChannelHandler handler, Promise<QuicStreamChannel> promise)
Returns a new HTTP/3 push-stream that will use the givenChannelHandler
to dispatchHttp3PushStreamFrame
s too.void
newPushStream(long pushId, @Nullable ChannelHandler handler, java.util.function.UnaryOperator<QuicStreamChannelBootstrap> bootstrapConfigurator, Promise<QuicStreamChannel> promise)
Returns a new HTTP/3 push-stream that will use the givenChannelHandler
to dispatchHttp3PushStreamFrame
s too.long
reserveNextPushId()
Reserves a push ID to be used to create a new push stream subsequently.
-
-
-
Constructor Detail
-
Http3ServerPushStreamManager
public Http3ServerPushStreamManager(QuicChannel channel)
Creates a new instance.- Parameters:
channel
- for which this manager is created.
-
Http3ServerPushStreamManager
public Http3ServerPushStreamManager(QuicChannel channel, int initialPushStreamsCountHint)
Creates a new instance.- Parameters:
channel
- for which this manager is created.initialPushStreamsCountHint
- a hint for the number of push streams that may be created.
-
-
Method Detail
-
isPushAllowed
public boolean isPushAllowed()
Returnstrue
if server push is allowed at this point.- Returns:
true
if server push is allowed at this point.
-
reserveNextPushId
public long reserveNextPushId()
Reserves a push ID to be used to create a new push stream subsequently. A push ID can only be used to create exactly one push stream.- Returns:
- Next push ID.
- Throws:
java.lang.IllegalStateException
- If it is not allowed to create any more push streams on the associatedQuicChannel
. UseisPushAllowed()
to check if server push is allowed.
-
newPushStream
public Future<QuicStreamChannel> newPushStream(long pushId, @Nullable @Nullable ChannelHandler handler)
Returns a new HTTP/3 push-stream that will use the givenChannelHandler
to dispatchHttp3PushStreamFrame
s too. The needed HTTP/3 codecs are automatically added to the pipeline as well.- Parameters:
pushId
- for the push stream. This MUST be obtained usingreserveNextPushId()
.handler
- theChannelHandler
to add. Can benull
.- Returns:
- the
Future
that will be notified once the push-stream was opened.
-
newPushStream
public void newPushStream(long pushId, @Nullable @Nullable ChannelHandler handler, Promise<QuicStreamChannel> promise)
Returns a new HTTP/3 push-stream that will use the givenChannelHandler
to dispatchHttp3PushStreamFrame
s too. The needed HTTP/3 codecs are automatically added to the pipeline as well.- Parameters:
pushId
- for the push stream. This MUST be obtained usingreserveNextPushId()
.handler
- theChannelHandler
to add. Can benull
.promise
- to indicate creation of the push stream.
-
newPushStream
public void newPushStream(long pushId, @Nullable @Nullable ChannelHandler handler, java.util.function.UnaryOperator<QuicStreamChannelBootstrap> bootstrapConfigurator, Promise<QuicStreamChannel> promise)
Returns a new HTTP/3 push-stream that will use the givenChannelHandler
to dispatchHttp3PushStreamFrame
s too. The needed HTTP/3 codecs are automatically added to the pipeline as well.- Parameters:
pushId
- for the push stream. This MUST be obtained usingreserveNextPushId()
.handler
- theChannelHandler
to add. Can benull
.bootstrapConfigurator
-UnaryOperator
to configure theQuicStreamChannelBootstrap
used.promise
- to indicate creation of the push stream.
-
controlStreamListener
public ChannelInboundHandler controlStreamListener()
AChannelInboundHandler
to be added to theQuicChannel
associated with thisHttp3ServerPushStreamManager
to listen to control stream frames.- Returns:
ChannelInboundHandler
to be added to theQuicChannel
associated with thisHttp3ServerPushStreamManager
to listen to control stream frames.
-
-