/** * Gets the {@code SETTINGS_MAX_HEADER_LIST_SIZE} value. If unavailable, returns {@code null}. */ public Long maxHeaderListSize() { return get(SETTINGS_MAX_HEADER_LIST_SIZE); }
/** * Gets the {@code SETTINGS_HEADER_TABLE_SIZE} value. If unavailable, returns {@code null}. */ public Long headerTableSize() { return get(SETTINGS_HEADER_TABLE_SIZE); }
/** * Gets the {@code SETTINGS_MAX_CONCURRENT_STREAMS} value. If unavailable, returns {@code null}. */ public Long maxConcurrentStreams() { return get(SETTINGS_MAX_CONCURRENT_STREAMS); }
/** * A helper method that returns {@link Long#intValue()} on the return of {@link #get(char)}, if present. Note that * if the range of the value exceeds {@link Integer#MAX_VALUE}, the {@link #get(char)} method should * be used instead to avoid truncation of the value. */ public Integer getIntValue(char key) { Long value = get(key); if (value == null) { return null; } return value.intValue(); }
/** * Gets the {@code SETTINGS_ENABLE_PUSH} value. If unavailable, returns {@code null}. */ public Boolean pushEnabled() { Long value = get(SETTINGS_ENABLE_PUSH); if (value == null) { return null; } return TRUE.equals(value); }
protected void updateSettings(Http2Settings settingsUpdate, Handler<AsyncResult<Void>> completionHandler) { Http2Settings current = handler.decoder().localSettings(); for (Map.Entry<Character, Long> entry : current.entrySet()) { Character key = entry.getKey(); if (Objects.equals(settingsUpdate.get(key), entry.getValue())) { settingsUpdate.remove(key); } } Handler<Void> pending = v -> { synchronized (Http2ConnectionBase.this) { localSettings.putAll(settingsUpdate); } if (completionHandler != null) { completionHandler.handle(Future.succeededFuture()); } }; updateSettingsHandlers.add(pending); handler.writeSettings(settingsUpdate).addListener(fut -> { if (!fut.isSuccess()) { synchronized (Http2ConnectionBase.this) { updateSettingsHandlers.remove(pending); } if (completionHandler != null) { completionHandler.handle(Future.failedFuture(fut.cause())); } } }); }
@Test public void toNettySettings() { Http2Settings settings = new Http2Settings(); for (int i = 7;i <= 0xFFFF;i += 1) { // we need to clamp the random value to pass validation settings.set(0xFFFF, Math.min(0xFFFFFFFFL, TestUtils.randomPositiveLong())); } io.netty.handler.codec.http2.Http2Settings conv = HttpUtils.fromVertxSettings(settings); for (int i = 1;i <= 0xFFFF;i += 1) { assertEquals(settings.get(i), conv.get((char)i)); } settings = HttpUtils.toVertxSettings(conv); for (int i = 1;i <= 0xFFFF;i += 1) { assertEquals(settings.get(i), conv.get((char)i)); } }
protected void updateSettings(Http2Settings settingsUpdate, Handler<AsyncResult<Void>> completionHandler) { Http2Settings current = handler.decoder().localSettings(); for (Map.Entry<Character, Long> entry : current.entrySet()) { Character key = entry.getKey(); if (Objects.equals(settingsUpdate.get(key), entry.getValue())) { settingsUpdate.remove(key); } } Handler<Void> pending = v -> { synchronized (Http2ConnectionBase.this) { localSettings.putAll(settingsUpdate); } if (completionHandler != null) { completionHandler.handle(Future.succeededFuture()); } }; updateSettingsHandlers.add(pending); handler.writeSettings(settingsUpdate).addListener(fut -> { if (!fut.isSuccess()) { synchronized (Http2ConnectionBase.this) { updateSettingsHandlers.remove(pending); } if (completionHandler != null) { completionHandler.handle(Future.failedFuture(fut.cause())); } } }); }
/** * Gets the {@code SETTINGS_HEADER_TABLE_SIZE} value. If unavailable, returns {@code null}. */ public Long headerTableSize() { return get(SETTINGS_HEADER_TABLE_SIZE); }
/** * Gets the {@code SETTINGS_MAX_HEADER_LIST_SIZE} value. If unavailable, returns {@code null}. */ public Long maxHeaderListSize() { return get(SETTINGS_MAX_HEADER_LIST_SIZE); }
/** * Gets the {@code SETTINGS_MAX_HEADER_LIST_SIZE} value. If unavailable, returns {@code null}. */ public Long maxHeaderListSize() { return get(SETTINGS_MAX_HEADER_LIST_SIZE); }
/** * Gets the {@code SETTINGS_MAX_CONCURRENT_STREAMS} value. If unavailable, returns {@code null}. */ public Long maxConcurrentStreams() { return get(SETTINGS_MAX_CONCURRENT_STREAMS); }
/** * Gets the {@code SETTINGS_HEADER_TABLE_SIZE} value. If unavailable, returns {@code null}. */ public Long headerTableSize() { return get(SETTINGS_HEADER_TABLE_SIZE); }
/** * Gets the {@code SETTINGS_MAX_CONCURRENT_STREAMS} value. If unavailable, returns {@code null}. */ public Long maxConcurrentStreams() { return get(SETTINGS_MAX_CONCURRENT_STREAMS); }
@Test public void toNettySettings() { Http2Settings settings = new Http2Settings(); for (int i = 7;i <= 0xFFFF;i += 1) { // we need to clamp the random value to pass validation settings.set(0xFFFF, Math.min(0xFFFFFFFFL, TestUtils.randomPositiveLong())); } io.netty.handler.codec.http2.Http2Settings conv = HttpUtils.fromVertxSettings(settings); for (int i = 1;i <= 0xFFFF;i += 1) { assertEquals(settings.get(i), conv.get((char)i)); } settings = HttpUtils.toVertxSettings(conv); for (int i = 1;i <= 0xFFFF;i += 1) { assertEquals(settings.get(i), conv.get((char)i)); } }
/** * Gets the {@code SETTINGS_ENABLE_PUSH} value. If unavailable, returns {@code null}. */ public Boolean pushEnabled() { Long value = get(SETTINGS_ENABLE_PUSH); if (value == null) { return null; } return TRUE.equals(value); }
/** * Gets the {@code SETTINGS_ENABLE_PUSH} value. If unavailable, returns {@code null}. */ public Boolean pushEnabled() { Long value = get(SETTINGS_ENABLE_PUSH); if (value == null) { return null; } return TRUE.equals(value); }
/** * A helper method that returns {@link Long#intValue()} on the return of {@link #get(char)}, if present. Note that * if the range of the value exceeds {@link Integer#MAX_VALUE}, the {@link #get(char)} method should * be used instead to avoid truncation of the value. */ public Integer getIntValue(char key) { Long value = get(key); if (value == null) { return null; } return value.intValue(); }
/** * A helper method that returns {@link Long#intValue()} on the return of {@link #get(char)}, if present. Note that * if the range of the value exceeds {@link Integer#MAX_VALUE}, the {@link #get(char)} method should * be used instead to avoid truncation of the value. */ public Integer getIntValue(char key) { Long value = get(key); if (value == null) { return null; } return value.intValue(); }