Search in sources :

Example 1 with Http2ReceiveListener

use of io.undertow.server.protocol.http2.Http2ReceiveListener in project undertow by undertow-io.

the class HttpReadListener method doHttp2PriRead.

private boolean doHttp2PriRead(StreamConnection connection, ByteBuffer buffer, HttpServerConnection serverConnection, PooledByteBuffer extraData) throws IOException {
    if (buffer.hasRemaining()) {
        int res = connection.getSourceChannel().read(buffer);
        if (res == -1) {
            //fail
            return true;
        }
        if (buffer.hasRemaining()) {
            return false;
        }
    }
    buffer.flip();
    for (int i = 0; i < PRI_EXPECTED.length; ++i) {
        if (buffer.get() != PRI_EXPECTED[i]) {
            throw UndertowMessages.MESSAGES.http2PriRequestFailed();
        }
    }
    Http2Channel channel = new Http2Channel(connection, null, serverConnection.getByteBufferPool(), extraData, false, false, false, serverConnection.getUndertowOptions());
    Http2ReceiveListener receiveListener = new Http2ReceiveListener(serverConnection.getRootHandler(), serverConnection.getUndertowOptions(), serverConnection.getBufferSize(), null);
    channel.getReceiveSetter().set(receiveListener);
    channel.resumeReceives();
    return true;
}
Also used : Http2Channel(io.undertow.protocols.http2.Http2Channel) Http2ReceiveListener(io.undertow.server.protocol.http2.Http2ReceiveListener)

Aggregations

Http2Channel (io.undertow.protocols.http2.Http2Channel)1 Http2ReceiveListener (io.undertow.server.protocol.http2.Http2ReceiveListener)1