All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.vertx.core.http.HttpServerOptionsConverter Maven / Gradle / Ivy
package io.vertx.core.http;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.impl.JsonUtil;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.Base64;
/**
* Converter and mapper for {@link io.vertx.core.http.HttpServerOptions}.
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.HttpServerOptions} original class using Vert.x codegen.
*/
public class HttpServerOptionsConverter {
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER;
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER;
static void fromJson(Iterable> json, HttpServerOptions obj) {
for (java.util.Map.Entry member : json) {
switch (member.getKey()) {
case "acceptUnmaskedFrames":
if (member.getValue() instanceof Boolean) {
obj.setAcceptUnmaskedFrames((Boolean)member.getValue());
}
break;
case "alpnVersions":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList list = new java.util.ArrayList<>();
((Iterable)member.getValue()).forEach( item -> {
if (item instanceof String)
list.add(io.vertx.core.http.HttpVersion.valueOf((String)item));
});
obj.setAlpnVersions(list);
}
break;
case "compressionLevel":
if (member.getValue() instanceof Number) {
obj.setCompressionLevel(((Number)member.getValue()).intValue());
}
break;
case "compressionSupported":
if (member.getValue() instanceof Boolean) {
obj.setCompressionSupported((Boolean)member.getValue());
}
break;
case "decoderInitialBufferSize":
if (member.getValue() instanceof Number) {
obj.setDecoderInitialBufferSize(((Number)member.getValue()).intValue());
}
break;
case "decompressionSupported":
if (member.getValue() instanceof Boolean) {
obj.setDecompressionSupported((Boolean)member.getValue());
}
break;
case "handle100ContinueAutomatically":
if (member.getValue() instanceof Boolean) {
obj.setHandle100ContinueAutomatically((Boolean)member.getValue());
}
break;
case "http2ClearTextEnabled":
if (member.getValue() instanceof Boolean) {
obj.setHttp2ClearTextEnabled((Boolean)member.getValue());
}
break;
case "http2ConnectionWindowSize":
if (member.getValue() instanceof Number) {
obj.setHttp2ConnectionWindowSize(((Number)member.getValue()).intValue());
}
break;
case "http2RstFloodMaxRstFramePerWindow":
if (member.getValue() instanceof Number) {
obj.setHttp2RstFloodMaxRstFramePerWindow(((Number)member.getValue()).intValue());
}
break;
case "http2RstFloodWindowDuration":
if (member.getValue() instanceof Number) {
obj.setHttp2RstFloodWindowDuration(((Number)member.getValue()).intValue());
}
break;
case "http2RstFloodWindowDurationTimeUnit":
if (member.getValue() instanceof String) {
obj.setHttp2RstFloodWindowDurationTimeUnit(java.util.concurrent.TimeUnit.valueOf((String)member.getValue()));
}
break;
case "initialSettings":
if (member.getValue() instanceof JsonObject) {
obj.setInitialSettings(new io.vertx.core.http.Http2Settings((io.vertx.core.json.JsonObject)member.getValue()));
}
break;
case "maxChunkSize":
if (member.getValue() instanceof Number) {
obj.setMaxChunkSize(((Number)member.getValue()).intValue());
}
break;
case "maxFormAttributeSize":
if (member.getValue() instanceof Number) {
obj.setMaxFormAttributeSize(((Number)member.getValue()).intValue());
}
break;
case "maxFormBufferedBytes":
if (member.getValue() instanceof Number) {
obj.setMaxFormBufferedBytes(((Number)member.getValue()).intValue());
}
break;
case "maxFormFields":
if (member.getValue() instanceof Number) {
obj.setMaxFormFields(((Number)member.getValue()).intValue());
}
break;
case "maxHeaderSize":
if (member.getValue() instanceof Number) {
obj.setMaxHeaderSize(((Number)member.getValue()).intValue());
}
break;
case "maxInitialLineLength":
if (member.getValue() instanceof Number) {
obj.setMaxInitialLineLength(((Number)member.getValue()).intValue());
}
break;
case "maxWebSocketFrameSize":
if (member.getValue() instanceof Number) {
obj.setMaxWebSocketFrameSize(((Number)member.getValue()).intValue());
}
break;
case "maxWebSocketMessageSize":
if (member.getValue() instanceof Number) {
obj.setMaxWebSocketMessageSize(((Number)member.getValue()).intValue());
}
break;
case "perFrameWebSocketCompressionSupported":
if (member.getValue() instanceof Boolean) {
obj.setPerFrameWebSocketCompressionSupported((Boolean)member.getValue());
}
break;
case "perMessageWebSocketCompressionSupported":
if (member.getValue() instanceof Boolean) {
obj.setPerMessageWebSocketCompressionSupported((Boolean)member.getValue());
}
break;
case "registerWebSocketWriteHandlers":
if (member.getValue() instanceof Boolean) {
obj.setRegisterWebSocketWriteHandlers((Boolean)member.getValue());
}
break;
case "tracingPolicy":
if (member.getValue() instanceof String) {
obj.setTracingPolicy(io.vertx.core.tracing.TracingPolicy.valueOf((String)member.getValue()));
}
break;
case "webSocketAllowServerNoContext":
if (member.getValue() instanceof Boolean) {
obj.setWebSocketAllowServerNoContext((Boolean)member.getValue());
}
break;
case "webSocketClosingTimeout":
if (member.getValue() instanceof Number) {
obj.setWebSocketClosingTimeout(((Number)member.getValue()).intValue());
}
break;
case "webSocketCompressionLevel":
if (member.getValue() instanceof Number) {
obj.setWebSocketCompressionLevel(((Number)member.getValue()).intValue());
}
break;
case "webSocketPreferredClientNoContext":
if (member.getValue() instanceof Boolean) {
obj.setWebSocketPreferredClientNoContext((Boolean)member.getValue());
}
break;
case "webSocketSubProtocols":
if (member.getValue() instanceof JsonArray) {
java.util.ArrayList list = new java.util.ArrayList<>();
((Iterable)member.getValue()).forEach( item -> {
if (item instanceof String)
list.add((String)item);
});
obj.setWebSocketSubProtocols(list);
}
break;
}
}
}
static void toJson(HttpServerOptions obj, JsonObject json) {
toJson(obj, json.getMap());
}
static void toJson(HttpServerOptions obj, java.util.Map json) {
json.put("acceptUnmaskedFrames", obj.isAcceptUnmaskedFrames());
if (obj.getAlpnVersions() != null) {
JsonArray array = new JsonArray();
obj.getAlpnVersions().forEach(item -> array.add(item.name()));
json.put("alpnVersions", array);
}
json.put("compressionLevel", obj.getCompressionLevel());
json.put("compressionSupported", obj.isCompressionSupported());
json.put("decoderInitialBufferSize", obj.getDecoderInitialBufferSize());
json.put("decompressionSupported", obj.isDecompressionSupported());
json.put("handle100ContinueAutomatically", obj.isHandle100ContinueAutomatically());
json.put("http2ClearTextEnabled", obj.isHttp2ClearTextEnabled());
json.put("http2ConnectionWindowSize", obj.getHttp2ConnectionWindowSize());
json.put("http2RstFloodMaxRstFramePerWindow", obj.getHttp2RstFloodMaxRstFramePerWindow());
json.put("http2RstFloodWindowDuration", obj.getHttp2RstFloodWindowDuration());
if (obj.getHttp2RstFloodWindowDurationTimeUnit() != null) {
json.put("http2RstFloodWindowDurationTimeUnit", obj.getHttp2RstFloodWindowDurationTimeUnit().name());
}
if (obj.getInitialSettings() != null) {
json.put("initialSettings", obj.getInitialSettings().toJson());
}
json.put("maxChunkSize", obj.getMaxChunkSize());
json.put("maxFormAttributeSize", obj.getMaxFormAttributeSize());
json.put("maxFormBufferedBytes", obj.getMaxFormBufferedBytes());
json.put("maxFormFields", obj.getMaxFormFields());
json.put("maxHeaderSize", obj.getMaxHeaderSize());
json.put("maxInitialLineLength", obj.getMaxInitialLineLength());
json.put("maxWebSocketFrameSize", obj.getMaxWebSocketFrameSize());
json.put("maxWebSocketMessageSize", obj.getMaxWebSocketMessageSize());
json.put("perFrameWebSocketCompressionSupported", obj.getPerFrameWebSocketCompressionSupported());
json.put("perMessageWebSocketCompressionSupported", obj.getPerMessageWebSocketCompressionSupported());
json.put("registerWebSocketWriteHandlers", obj.isRegisterWebSocketWriteHandlers());
if (obj.getTracingPolicy() != null) {
json.put("tracingPolicy", obj.getTracingPolicy().name());
}
json.put("webSocketAllowServerNoContext", obj.getWebSocketAllowServerNoContext());
json.put("webSocketClosingTimeout", obj.getWebSocketClosingTimeout());
json.put("webSocketCompressionLevel", obj.getWebSocketCompressionLevel());
json.put("webSocketPreferredClientNoContext", obj.getWebSocketPreferredClientNoContext());
if (obj.getWebSocketSubProtocols() != null) {
JsonArray array = new JsonArray();
obj.getWebSocketSubProtocols().forEach(item -> array.add(item));
json.put("webSocketSubProtocols", array);
}
}
}