Package io.netty.handler.codec.http3
Class Http3ServerPushStreamManager
- java.lang.Object
-
- io.netty.handler.codec.http3.Http3ServerPushStreamManager
-
public final class Http3ServerPushStreamManager extends java.lang.ObjectA manager for push streams for a server. New push streams can be initiated using the variousnewPushStreammethods. It is required to add theChannelHandlerreturned fromcontrolStreamListener()to theQuicChannelassociated 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 ChannelInboundHandlercontrolStreamListener()AChannelInboundHandlerto be added to theQuicChannelassociated with thisHttp3ServerPushStreamManagerto listen to control stream frames.booleanisPushAllowed()Returnstrueif 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 givenChannelHandlerto dispatchHttp3PushStreamFrames too.voidnewPushStream(long pushId, @Nullable ChannelHandler handler, Promise<QuicStreamChannel> promise)Returns a new HTTP/3 push-stream that will use the givenChannelHandlerto dispatchHttp3PushStreamFrames too.voidnewPushStream(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 givenChannelHandlerto dispatchHttp3PushStreamFrames too.longreserveNextPushId()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()
Returnstrueif server push is allowed at this point.- Returns:
trueif 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 givenChannelHandlerto dispatchHttp3PushStreamFrames 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- theChannelHandlerto add. Can benull.- Returns:
- the
Futurethat 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 givenChannelHandlerto dispatchHttp3PushStreamFrames 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- theChannelHandlerto 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 givenChannelHandlerto dispatchHttp3PushStreamFrames 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- theChannelHandlerto add. Can benull.bootstrapConfigurator-UnaryOperatorto configure theQuicStreamChannelBootstrapused.promise- to indicate creation of the push stream.
-
controlStreamListener
public ChannelInboundHandler controlStreamListener()
AChannelInboundHandlerto be added to theQuicChannelassociated with thisHttp3ServerPushStreamManagerto listen to control stream frames.- Returns:
ChannelInboundHandlerto be added to theQuicChannelassociated with thisHttp3ServerPushStreamManagerto listen to control stream frames.
-
-