Example usage for io.netty.handler.codec.http2 Http2DataFrame content

List of usage examples for io.netty.handler.codec.http2 Http2DataFrame content

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 Http2DataFrame content.

Prototype

@Override
ByteBuf content();

Source Link

Document

Payload of DATA frame.

Usage

From source file:com.flysoloing.learning.network.netty.http2.helloworld.multiplex.server.HelloWorldHttp2Handler.java

License:Apache License

/**
 * If receive a frame with end-of-stream set, send a pre-canned response.
 *//*w  w  w  . ja  v  a  2s  .  c o m*/
public void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
    if (data.isEndStream()) {
        sendResponse(ctx, data.content().retain());
    }
}

From source file:example.http2.helloworld.frame.server.HelloWorldHttp2Handler.java

License:Apache License

/**
 * If receive a frame with end-of-stream set, send a pre-canned response.
 *///from  w w  w.  j ava 2s .  co m
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));
}

From source file:example.http2.helloworld.multiplex.server.HelloWorldHttp2Handler.java

License:Apache License

/**
 * If receive a frame with end-of-stream set, send a pre-canned response.
 *///from   w w  w  . j  av a  2s.  c o  m
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();
    }
}

From source file:me.netty.http.handler.HelloWorldHttp2Handler.java

License:Apache License

/**
 * If receive a frame with end-of-stream set, send a pre-canned response.
 *//*w ww .  ja v  a 2  s .c om*/
public void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
    if (data.isEndStream()) {
        sendResponse(ctx, data.content().retain());
    }

    logger.debug("get body stream id is : " + data.streamId());
}

From source file:org.glassfish.jersey.netty.httpserver.JerseyHttp2ServerHandler.java

License:Open Source License

/**
 * Process incoming data./*from w w  w .  ja va  2 s .c  o  m*/
 */
private void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
    isList.add(new ByteBufInputStream(data.content()));
    if (data.isEndStream()) {
        isList.add(NettyInputStream.END_OF_INPUT);
    }
}