/** * Get the {@link FullHttpMessage} associated with {@code stream}. * @param stream The stream to get the associated state from * @return The {@link FullHttpMessage} associated with {@code stream}. */ protected final FullHttpMessage getMessage(Http2Stream stream) { return (FullHttpMessage) stream.getProperty(messageKey); }
@Override public void onStreamClosed(Http2Stream stream) { DefaultHttp2FrameStream stream2 = stream.getProperty(streamKey); if (stream2 != null) { onHttp2StreamStateChanged(ctx, stream2); } }
@Override public void onStreamHalfClosed(Http2Stream stream) { DefaultHttp2FrameStream stream2 = stream.getProperty(streamKey); if (stream2 != null) { onHttp2StreamStateChanged(ctx, stream2); } } }
@Override public void onStreamClosed(Http2Stream stream) { DefaultHttp2FrameStream stream2 = stream.getProperty(streamKey); if (stream2 != null) { onHttp2StreamStateChanged(ctx, stream2); } }
@Override public void onStreamRemoved(Http2Stream stream) { final EmbeddedChannel compressor = stream.getProperty(propertyKey); if (compressor != null) { cleanup(stream, compressor); } } });
private Http2FrameStream requireStream(int streamId) { Http2FrameStream stream = connection().stream(streamId).getProperty(streamKey); if (stream == null) { throw new IllegalStateException("Stream object required for identifier: " + streamId); } return stream; } }
@Override public boolean visit(Http2Stream stream) { try { return streamVisitor.visit((Http2FrameStream) stream.getProperty(streamKey)); } catch (Throwable cause) { onError(ctx, false, cause); return false; } } });
private Http2FrameStream requireStream(int streamId) { Http2FrameStream stream = connection().stream(streamId).getProperty(streamKey); if (stream == null) { throw new IllegalStateException("Stream object required for identifier: " + streamId); } return stream; } }
@Override public boolean visit(Http2Stream stream) { try { return streamVisitor.visit((Http2FrameStream) stream.getProperty(streamKey)); } catch (Throwable cause) { onError(ctx, false, cause); return false; } } });
@Override public void onStreamClosed(Http2Stream stream) { DefaultHttp2FrameStream stream2 = stream.getProperty(streamKey); if (stream2 != null) { onHttp2StreamStateChanged(ctx, stream2); } }
@Override public void onStreamHalfClosed(Http2Stream stream) { DefaultHttp2FrameStream stream2 = stream.getProperty(streamKey); if (stream2 != null) { onHttp2StreamStateChanged(ctx, stream2); } } }
@Override public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) { int processed = data.readableBytes() + padding; if (endOfStream) { Http2Stream http2Stream = connection().stream(streamId); // read cached http2 header from stream Http2Headers headers = http2Stream.getProperty(headerKey); handleRequest(ctx, streamId, headers, data); } return processed; }
@Override public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) { int processed = data.readableBytes() + padding; if (endOfStream) { Http2Stream http2Stream = connection().stream(streamId); // read cached http2 header from stream Http2Headers headers = http2Stream.getProperty(headerKey); handleRequest(ctx, streamId, headers, data); } return processed; }
private Http2FrameStream requireStream(int streamId) { Http2FrameStream stream = connection().stream(streamId).getProperty(streamKey); if (stream == null) { throw new IllegalStateException("Stream object required for identifier: " + streamId); } return stream; } }
final boolean consumeBytes(int streamId, int bytes) throws Http2Exception { Http2Stream stream = connection().stream(streamId); // Upgraded requests are ineligible for stream control. We add the null check // in case the stream has been deregistered. if (stream != null && streamId == Http2CodecUtil.HTTP_UPGRADE_STREAM_ID) { Boolean upgraded = stream.getProperty(upgradeKey); if (Boolean.TRUE.equals(upgraded)) { return false; } } return connection().local().flowController().consumeBytes(stream, bytes); }
@Override public boolean visit(Http2Stream stream) { try { return streamVisitor.visit((Http2FrameStream) stream.getProperty(streamKey)); } catch (Throwable cause) { onError(ctx, false, cause); return false; } } });
@Override public void writabilityChanged(Http2Stream stream) { Http2FrameStream frameStream = stream.getProperty(streamKey); if (frameStream == null) { return; } onHttp2StreamWritabilityChanged( ctx, frameStream, connection().remote().flowController().isWritable(stream)); } }
@Override public void writabilityChanged(Http2Stream stream) { Http2FrameStream frameStream = stream.getProperty(streamKey); if (frameStream == null) { return; } onHttp2StreamWritabilityChanged( ctx, frameStream, connection().remote().flowController().isWritable(stream)); } }
final boolean consumeBytes(int streamId, int bytes) throws Http2Exception { Http2Stream stream = connection().stream(streamId); // Upgraded requests are ineligible for stream control. We add the null check // in case the stream has been deregistered. if (stream != null && streamId == Http2CodecUtil.HTTP_UPGRADE_STREAM_ID) { Boolean upgraded = stream.getProperty(upgradeKey); if (Boolean.TRUE.equals(upgraded)) { return false; } } return connection().local().flowController().consumeBytes(stream, bytes); }
@Override public void writabilityChanged(Http2Stream stream) { Http2FrameStream frameStream = stream.getProperty(streamKey); if (frameStream == null) { return; } onHttp2StreamWritabilityChanged( ctx, frameStream, connection().remote().flowController().isWritable(stream)); } }