Java Code Examples for io.netty.handler.codec.http2.Http2DataFrame#release()

The following examples show how to use io.netty.handler.codec.http2.Http2DataFrame#release() . 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: HelloWorldHttp2Handler.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * If receive a frame with end-of-stream set, send a pre-canned response.
 */
private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
    if (data.isEndStream()) {
        sendResponse(ctx, data.content());
    } else {
        // We do not send back the response to the remote-peer, so we need to release it.
        data.release();
    }
}
 
Example 2
Source File: HelloWorldHttp2Handler.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
/**
 * If receive a frame with end-of-stream set, send a pre-canned response.
 */
private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
    Http2FrameStream stream = data.stream();

    if (data.isEndStream()) {
        sendResponse(ctx, stream, data.content());
    } else {
        // We do not send back the response to the remote-peer, so we need to release it.
        data.release();
    }

    // Update the flowcontroller
    ctx.write(new DefaultHttp2WindowUpdateFrame(data.initialFlowControlledBytes()).stream(stream));
}
 
Example 3
Source File: AbstractH2DuplexHandler.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
@Nullable
private static Http2DataFrame release(Http2DataFrame dataFrame) {
    dataFrame.release();
    return null;
}