Java Code Examples for io.netty.handler.codec.http2.Http2Stream#getProperty()

The following examples show how to use io.netty.handler.codec.http2.Http2Stream#getProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Http2ServerChannelHandler.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) {
    int processed = data.readableBytes() + padding;

    Http2Stream http2Stream = connection().stream(streamId);
    ByteBuf msg = http2Stream.getProperty(messageKey);
    if (msg == null) {
        msg = ctx.alloc().buffer();
        http2Stream.setProperty(messageKey, msg);
    }
    final int dataReadableBytes = data.readableBytes();
    msg.writeBytes(data, data.readerIndex(), dataReadableBytes);

    if (endOfStream) {
        // read cached http2 header from stream
        Http2Headers headers = http2Stream.getProperty(headerKey);
        handleRequest(ctx, streamId, headers, msg);
    }
    return processed;
}
 
Example 2
Source File: NettyServerHandler.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the server stream associated to the given HTTP/2 stream object.
 */
private NettyServerStream.TransportState serverStream(Http2Stream stream) {
  return stream == null ? null : (NettyServerStream.TransportState) stream.getProperty(streamKey);
}
 
Example 3
Source File: NettyClientHandler.java    From grpc-nebula-java with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the client stream associated to the given HTTP/2 stream object.
 */
private NettyClientStream.TransportState clientStream(Http2Stream stream) {
  return stream == null ? null : (NettyClientStream.TransportState) stream.getProperty(streamKey);
}
 
Example 4
Source File: NoPriorityByteDistributionBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
private DataRefresher dataRefresher(Http2Stream stream) {
    return (DataRefresher) stream.getProperty(dataRefresherKey);
}
 
Example 5
Source File: NettyServerHandler.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the server stream associated to the given HTTP/2 stream object.
 */
private NettyServerStream.TransportState serverStream(Http2Stream stream) {
  return stream == null ? null : (NettyServerStream.TransportState) stream.getProperty(streamKey);
}
 
Example 6
Source File: NettyClientHandler.java    From grpc-java with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the client stream associated to the given HTTP/2 stream object.
 */
private NettyClientStream.TransportState clientStream(Http2Stream stream) {
  return stream == null ? null : (NettyClientStream.TransportState) stream.getProperty(streamKey);
}