public StreamBufferingEncoder(Http2ConnectionEncoder delegate, int initialMaxConcurrentStreams) { super(delegate); this.maxConcurrentStreams = initialMaxConcurrentStreams; connection().addListener(new Http2ConnectionAdapter() { @Override public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) { cancelGoAwayStreams(lastStreamId, errorCode, debugData); } @Override public void onStreamClosed(Http2Stream stream) { tryCreatePendingStreams(); } }); }
public DelegatingDecompressorFrameListener(Http2Connection connection, Http2FrameListener listener, boolean strict) { super(listener); this.connection = connection; this.strict = strict; propertyKey = connection.newKey(); connection.addListener(new Http2ConnectionAdapter() { @Override public void onStreamRemoved(Http2Stream stream) { final Http2Decompressor decompressor = decompressor(stream); if (decompressor != null) { cleanup(decompressor); } } }); }
public CompressorHttp2ConnectionEncoder(Http2ConnectionEncoder delegate, int compressionLevel, int windowBits, int memLevel) { super(delegate); if (compressionLevel < 0 || compressionLevel > 9) { throw new IllegalArgumentException("compressionLevel: " + compressionLevel + " (expected: 0-9)"); } if (windowBits < 9 || windowBits > 15) { throw new IllegalArgumentException("windowBits: " + windowBits + " (expected: 9-15)"); } if (memLevel < 1 || memLevel > 9) { throw new IllegalArgumentException("memLevel: " + memLevel + " (expected: 1-9)"); } this.compressionLevel = compressionLevel; this.windowBits = windowBits; this.memLevel = memLevel; propertyKey = connection().newKey(); connection().addListener(new Http2ConnectionAdapter() { @Override public void onStreamRemoved(Http2Stream stream) { final EmbeddedChannel compressor = stream.getProperty(propertyKey); if (compressor != null) { cleanup(stream, compressor); } } }); }
/** * Builds/creates a new {@link InboundHttp2ToHttpAdapter} instance using this builder's current settings. */ protected T build() { final T instance; try { instance = build(connection(), maxContentLength(), isValidateHttpHeaders(), isPropagateSettings()); } catch (Throwable t) { throw new IllegalStateException("failed to create a new InboundHttp2ToHttpAdapter", t); } connection.addListener(instance); return instance; }
public VertxHttp2ConnectionHandler( Function<VertxHttp2ConnectionHandler<C>, C> connectionFactory, boolean useDecompressor, Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); this.connectionFactory = connectionFactory; this.useDecompressor = useDecompressor; encoder().flowController().listener(s -> { if (connection != null) { connection.onStreamWritabilityChanged(s); } }); connection().addListener(this); }
public UniformStreamByteDistributor(Http2Connection connection) { // Add a state for the connection. stateKey = connection.newKey(); Http2Stream connectionStream = connection.connectionStream(); connectionStream.setProperty(stateKey, new State(connectionStream)); // Register for notification of new streams. connection.addListener(new Http2ConnectionAdapter() { @Override public void onStreamAdded(Http2Stream stream) { stream.setProperty(stateKey, new State(stream)); } @Override public void onStreamClosed(Http2Stream stream) { state(stream).close(); } }); }
ApnsClientHandler(final Http2ConnectionDecoder decoder, final Http2ConnectionEncoder encoder, final Http2Settings initialSettings, final String authority, final long idlePingIntervalMillis) { super(decoder, encoder, initialSettings); this.authority = authority; this.responseHeadersPropertyKey = this.connection().newKey(); this.responsePromisePropertyKey = this.connection().newKey(); this.streamErrorCausePropertyKey = this.connection().newKey(); this.connection().addListener(this); this.pingTimeoutMillis = idlePingIntervalMillis / 2; }
Http2ServerConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, Channel channel, ServerConfig config, GracefulShutdownSupport gracefulShutdownSupport) { super(decoder, encoder, initialSettings); this.gracefulShutdownSupport = gracefulShutdownSupport; requestDecoder = new Http2RequestDecoder(config, channel, encoder()); connection().addListener(requestDecoder); decoder().frameListener(requestDecoder); // Setup post build options final long timeout = config.idleTimeoutMillis(); if (timeout > 0) { gracefulShutdownTimeoutMillis(timeout); } else { // Timeout disabled gracefulShutdownTimeoutMillis(-1); } }
Http2ClientConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, Channel channel, HttpClientFactory clientFactory) { super(decoder, encoder, initialSettings); this.clientFactory = clientFactory; responseDecoder = new Http2ResponseDecoder(channel, encoder(), clientFactory); connection().addListener(responseDecoder); decoder().frameListener(responseDecoder); // Setup post build options final long timeout = clientFactory.idleTimeoutMillis(); if (timeout > 0) { gracefulShutdownTimeoutMillis(timeout); } else { // Timeout disabled gracefulShutdownTimeoutMillis(-1); } }
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
connection.addListener(new Http2ConnectionAdapter() { @Override public void onStreamAdded(Http2Stream stream) {
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
connection.addListener(new Http2ConnectionAdapter() { @Override public void onStreamAdded(Http2Stream stream) {
connection.addListener(new Http2ConnectionAdapter() { @Override public void onStreamAdded(Http2Stream stream) {
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
public VertxHttp2ConnectionHandler( Function<VertxHttp2ConnectionHandler<C>, C> connectionFactory, boolean useDecompressor, Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); this.connectionFactory = connectionFactory; this.useDecompressor = useDecompressor; encoder().flowController().listener(s -> { if (connection != null) { connection.onStreamWritabilityChanged(s); } }); connection().addListener(this); }
public Http2ClientChannel(Http2ConnectionManager http2ConnectionManager, Http2Connection connection, HttpRoute httpRoute, Channel channel) { this.http2ConnectionManager = http2ConnectionManager; this.channel = channel; this.connection = connection; this.httpRoute = httpRoute; streamCloseListener = new StreamCloseListener(this); this.connection.addListener(streamCloseListener); dataEventListeners = new HashMap<>(); inFlightMessages = new ConcurrentHashMap<>(); promisedMessages = new ConcurrentHashMap<>(); }
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }