Example usage for io.netty.handler.codec.http2 Http2Settings put

List of usage examples for io.netty.handler.codec.http2 Http2Settings put

Introduction

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

Prototype

@Override
public Long put(char key, Long value) 

Source Link

Document

Adds the given setting key/value pair.

Usage

From source file:io.vertx.core.http.impl.HttpUtils.java

License:Open Source License

public static void fromVertxInitialSettings(boolean server, io.vertx.core.http.Http2Settings vertxSettings,
        Http2Settings nettySettings) {
    if (vertxSettings != null) {
        if (!server && vertxSettings.isPushEnabled() != DEFAULT_ENABLE_PUSH) {
            nettySettings.pushEnabled(vertxSettings.isPushEnabled());
        }/*  w  ww  .j a  v  a  2  s.c om*/
        if (vertxSettings.getHeaderTableSize() != DEFAULT_HEADER_TABLE_SIZE) {
            nettySettings.put('\u0001', (Long) vertxSettings.getHeaderTableSize());
        }
        if (vertxSettings.getInitialWindowSize() != DEFAULT_INITIAL_WINDOW_SIZE) {
            nettySettings.initialWindowSize(vertxSettings.getInitialWindowSize());
        }
        if (vertxSettings.getMaxConcurrentStreams() != DEFAULT_MAX_CONCURRENT_STREAMS) {
            nettySettings.maxConcurrentStreams(vertxSettings.getMaxConcurrentStreams());
        }
        if (vertxSettings.getMaxFrameSize() != DEFAULT_MAX_FRAME_SIZE) {
            nettySettings.maxFrameSize(vertxSettings.getMaxFrameSize());
        }
        if (vertxSettings.getMaxHeaderListSize() != DEFAULT_MAX_HEADER_LIST_SIZE) {
            nettySettings.maxHeaderListSize(vertxSettings.getMaxHeaderListSize());
        }
        Map<Integer, Long> extraSettings = vertxSettings.getExtraSettings();
        if (extraSettings != null) {
            extraSettings.forEach((code, setting) -> {
                nettySettings.put((char) (int) code, setting);
            });
        }
    }
}

From source file:io.vertx.core.http.impl.HttpUtils.java

License:Open Source License

public static Http2Settings fromVertxSettings(io.vertx.core.http.Http2Settings settings) {
    Http2Settings converted = new Http2Settings();
    converted.pushEnabled(settings.isPushEnabled());
    converted.maxFrameSize(settings.getMaxFrameSize());
    converted.initialWindowSize(settings.getInitialWindowSize());
    converted.headerTableSize(settings.getHeaderTableSize());
    converted.maxConcurrentStreams(settings.getMaxConcurrentStreams());
    converted.maxHeaderListSize(settings.getMaxHeaderListSize());
    if (settings.getExtraSettings() != null) {
        settings.getExtraSettings().forEach((key, value) -> {
            converted.put((char) (int) key, value);
        });//ww  w  . j a va  2  s. c  o m
    }
    return converted;
}

From source file:io.vertx.core.http.impl.HttpUtils.java

License:Open Source License

static Http2Settings decodeSettings(String base64Settings) {
    try {/*  w  ww. jav a2  s .  co  m*/
        Http2Settings settings = new Http2Settings();
        Buffer buffer = Buffer.buffer(Base64.getUrlDecoder().decode(base64Settings));
        int pos = 0;
        int len = buffer.length();
        while (pos < len) {
            int i = buffer.getUnsignedShort(pos);
            pos += 2;
            long j = buffer.getUnsignedInt(pos);
            pos += 4;
            settings.put((char) i, (Long) j);
        }
        return settings;
    } catch (Exception ignore) {
    }
    return null;
}