Skip to content

Commit

Permalink
Fixes Http*Options serialization
Browse files Browse the repository at this point in the history
Signed-off-by: Ruslan Sennov <ruslan.sennov@gmail.com>
  • Loading branch information
ruslansennov authored and vietj committed Feb 15, 2017
1 parent 3034cfd commit f56e788
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 107 deletions.
14 changes: 7 additions & 7 deletions src/main/asciidoc/dataobjects.adoc
Expand Up @@ -239,7 +239,7 @@ Set whether all server certificates should be trusted
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[useAlpn]]`useAlpn`|`Boolean`| |[[useAlpn]]`useAlpn`|`Boolean`|
+++ +++
Expand Down Expand Up @@ -550,7 +550,7 @@ Set whether all server certificates should be trusted.
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[useAlpn]]`useAlpn`|`Boolean`| |[[useAlpn]]`useAlpn`|`Boolean`|
+++ +++
Expand Down Expand Up @@ -843,7 +843,7 @@ Set whether all server certificates should be trusted
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[tryUseCompression]]`tryUseCompression`|`Boolean`| |[[tryUseCompression]]`tryUseCompression`|`Boolean`|
+++ +++
Expand Down Expand Up @@ -1051,7 +1051,7 @@ Set the value of traffic class
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[useAlpn]]`useAlpn`|`Boolean`| |[[useAlpn]]`useAlpn`|`Boolean`|
+++ +++
Expand Down Expand Up @@ -1276,7 +1276,7 @@ Set whether all server certificates should be trusted
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[useAlpn]]`useAlpn`|`Boolean`| |[[useAlpn]]`useAlpn`|`Boolean`|
+++ +++
Expand Down Expand Up @@ -1401,7 +1401,7 @@ Set the value of traffic class
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[useAlpn]]`useAlpn`|`Boolean`| |[[useAlpn]]`useAlpn`|`Boolean`|
+++ +++
Expand Down Expand Up @@ -1923,7 +1923,7 @@ Set the value of traffic class
+++ +++
|[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`| |[[trustStoreOptions]]`trustStoreOptions`|`link:dataobjects.html#JksOptions[JksOptions]`|
+++ +++
Set the trust options in jks format, aka Java trustore Set the trust options in jks format, aka Java truststore
+++ +++
|[[useAlpn]]`useAlpn`|`Boolean`| |[[useAlpn]]`useAlpn`|`Boolean`|
+++ +++
Expand Down
Expand Up @@ -189,7 +189,28 @@ public static void toJson(EventBusOptions obj, JsonObject json) {
json.put("host", obj.getHost()); json.put("host", obj.getHost());
} }
json.put("idleTimeout", obj.getIdleTimeout()); json.put("idleTimeout", obj.getIdleTimeout());
if (obj.getJdkSslEngineOptions() != null) {
json.put("jdkSslEngineOptions", obj.getJdkSslEngineOptions().toJson());
}
if (obj.getKeyStoreOptions() != null) {
json.put("keyStoreOptions", obj.getKeyStoreOptions().toJson());
}
json.put("logActivity", obj.getLogActivity()); json.put("logActivity", obj.getLogActivity());
if (obj.getOpenSslEngineOptions() != null) {
json.put("openSslEngineOptions", obj.getOpenSslEngineOptions().toJson());
}
if (obj.getPemKeyCertOptions() != null) {
json.put("pemKeyCertOptions", obj.getPemKeyCertOptions().toJson());
}
if (obj.getPemTrustOptions() != null) {
json.put("pemTrustOptions", obj.getPemTrustOptions().toJson());
}
if (obj.getPfxKeyCertOptions() != null) {
json.put("pfxKeyCertOptions", obj.getPfxKeyCertOptions().toJson());
}
if (obj.getPfxTrustOptions() != null) {
json.put("pfxTrustOptions", obj.getPfxTrustOptions().toJson());
}
json.put("port", obj.getPort()); json.put("port", obj.getPort());
json.put("receiveBufferSize", obj.getReceiveBufferSize()); json.put("receiveBufferSize", obj.getReceiveBufferSize());
json.put("reconnectAttempts", obj.getReconnectAttempts()); json.put("reconnectAttempts", obj.getReconnectAttempts());
Expand All @@ -202,6 +223,9 @@ public static void toJson(EventBusOptions obj, JsonObject json) {
json.put("tcpNoDelay", obj.isTcpNoDelay()); json.put("tcpNoDelay", obj.isTcpNoDelay());
json.put("trafficClass", obj.getTrafficClass()); json.put("trafficClass", obj.getTrafficClass());
json.put("trustAll", obj.isTrustAll()); json.put("trustAll", obj.isTrustAll());
if (obj.getTrustStoreOptions() != null) {
json.put("trustStoreOptions", obj.getTrustStoreOptions().toJson());
}
json.put("useAlpn", obj.isUseAlpn()); json.put("useAlpn", obj.isUseAlpn());
json.put("usePooledBuffers", obj.isUsePooledBuffers()); json.put("usePooledBuffers", obj.isUsePooledBuffers());
} }
Expand Down
24 changes: 24 additions & 0 deletions src/main/generated/io/vertx/core/net/TCPSSLOptionsConverter.java
Expand Up @@ -120,10 +120,34 @@ public static void toJson(TCPSSLOptions obj, JsonObject json) {
json.put("enabledSecureTransportProtocols", array); json.put("enabledSecureTransportProtocols", array);
} }
json.put("idleTimeout", obj.getIdleTimeout()); json.put("idleTimeout", obj.getIdleTimeout());
if (obj.getJdkSslEngineOptions() != null) {
json.put("jdkSslEngineOptions", obj.getJdkSslEngineOptions().toJson());
}
if (obj.getKeyStoreOptions() != null) {
json.put("keyStoreOptions", obj.getKeyStoreOptions().toJson());
}
if (obj.getOpenSslEngineOptions() != null) {
json.put("openSslEngineOptions", obj.getOpenSslEngineOptions().toJson());
}
if (obj.getPemKeyCertOptions() != null) {
json.put("pemKeyCertOptions", obj.getPemKeyCertOptions().toJson());
}
if (obj.getPemTrustOptions() != null) {
json.put("pemTrustOptions", obj.getPemTrustOptions().toJson());
}
if (obj.getPfxKeyCertOptions() != null) {
json.put("pfxKeyCertOptions", obj.getPfxKeyCertOptions().toJson());
}
if (obj.getPfxTrustOptions() != null) {
json.put("pfxTrustOptions", obj.getPfxTrustOptions().toJson());
}
json.put("soLinger", obj.getSoLinger()); json.put("soLinger", obj.getSoLinger());
json.put("ssl", obj.isSsl()); json.put("ssl", obj.isSsl());
json.put("tcpKeepAlive", obj.isTcpKeepAlive()); json.put("tcpKeepAlive", obj.isTcpKeepAlive());
json.put("tcpNoDelay", obj.isTcpNoDelay()); json.put("tcpNoDelay", obj.isTcpNoDelay());
if (obj.getTrustStoreOptions() != null) {
json.put("trustStoreOptions", obj.getTrustStoreOptions().toJson());
}
json.put("useAlpn", obj.isUseAlpn()); json.put("useAlpn", obj.isUseAlpn());
json.put("usePooledBuffers", obj.isUsePooledBuffers()); json.put("usePooledBuffers", obj.isUsePooledBuffers());
} }
Expand Down
23 changes: 12 additions & 11 deletions src/main/java/io/vertx/core/http/HttpClientOptions.java
Expand Up @@ -19,17 +19,7 @@
import io.vertx.codegen.annotations.DataObject; import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.buffer.Buffer; import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonObject; import io.vertx.core.json.JsonObject;
import io.vertx.core.net.ClientOptionsBase; import io.vertx.core.net.*;
import io.vertx.core.net.JdkSSLEngineOptions;
import io.vertx.core.net.JksOptions;
import io.vertx.core.net.KeyCertOptions;
import io.vertx.core.net.OpenSSLEngineOptions;
import io.vertx.core.net.PemKeyCertOptions;
import io.vertx.core.net.PemTrustOptions;
import io.vertx.core.net.PfxOptions;
import io.vertx.core.net.ProxyOptions;
import io.vertx.core.net.SSLEngineOptions;
import io.vertx.core.net.TrustOptions;


import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
Expand Down Expand Up @@ -222,6 +212,17 @@ public HttpClientOptions(JsonObject json) {
HttpClientOptionsConverter.fromJson(json, this); HttpClientOptionsConverter.fromJson(json, this);
} }


/**
* Convert to JSON
*
* @return the JSON
*/
public JsonObject toJson() {
JsonObject json = super.toJson();
HttpClientOptionsConverter.toJson(this, json);
return json;
}

private void init() { private void init() {
verifyHost = DEFAULT_VERIFY_HOST; verifyHost = DEFAULT_VERIFY_HOST;
maxPoolSize = DEFAULT_MAX_POOL_SIZE; maxPoolSize = DEFAULT_MAX_POOL_SIZE;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/vertx/core/http/HttpServerOptions.java
Expand Up @@ -156,6 +156,17 @@ public HttpServerOptions(JsonObject json) {
HttpServerOptionsConverter.fromJson(json, this); HttpServerOptionsConverter.fromJson(json, this);
} }


/**
* Convert to JSON
*
* @return the JSON
*/
public JsonObject toJson() {
JsonObject json = super.toJson();
HttpServerOptionsConverter.toJson(this, json);
return json;
}

private void init() { private void init() {
compressionSupported = DEFAULT_COMPRESSION_SUPPORTED; compressionSupported = DEFAULT_COMPRESSION_SUPPORTED;
compressionLevel = DEFAULT_COMPRESSION_LEVEL; compressionLevel = DEFAULT_COMPRESSION_LEVEL;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/vertx/core/net/ClientOptionsBase.java
Expand Up @@ -83,6 +83,17 @@ public ClientOptionsBase(JsonObject json) {
ClientOptionsBaseConverter.fromJson(json, this); ClientOptionsBaseConverter.fromJson(json, this);
} }


/**
* Convert to JSON
*
* @return the JSON
*/
public JsonObject toJson() {
JsonObject json = super.toJson();
ClientOptionsBaseConverter.toJson(this, json);
return json;
}

private void init() { private void init() {
this.connectTimeout = DEFAULT_CONNECT_TIMEOUT; this.connectTimeout = DEFAULT_CONNECT_TIMEOUT;
this.trustAll = DEFAULT_TRUST_ALL; this.trustAll = DEFAULT_TRUST_ALL;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/vertx/core/net/JdkSSLEngineOptions.java
Expand Up @@ -41,6 +41,10 @@ public JdkSSLEngineOptions(JsonObject json) {
public JdkSSLEngineOptions(JdkSSLEngineOptions that) { public JdkSSLEngineOptions(JdkSSLEngineOptions that) {
} }


public JsonObject toJson() {
return new JsonObject();
}

@Override @Override
public int hashCode() { public int hashCode() {
return 0; return 0;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/vertx/core/net/NetServerOptions.java
Expand Up @@ -88,6 +88,17 @@ public NetServerOptions(JsonObject json) {
NetServerOptionsConverter.fromJson(json, this); NetServerOptionsConverter.fromJson(json, this);
} }


/**
* Convert to JSON
*
* @return the JSON
*/
public JsonObject toJson() {
JsonObject json = super.toJson();
NetServerOptionsConverter.toJson(this, json);
return json;
}

@Override @Override
public NetServerOptions setSendBufferSize(int sendBufferSize) { public NetServerOptions setSendBufferSize(int sendBufferSize) {
super.setSendBufferSize(sendBufferSize); super.setSendBufferSize(sendBufferSize);
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/vertx/core/net/NetworkOptions.java
Expand Up @@ -92,6 +92,17 @@ public NetworkOptions(JsonObject json) {
NetworkOptionsConverter.fromJson(json, this); NetworkOptionsConverter.fromJson(json, this);
} }


/**
* Convert to JSON
*
* @return the JSON
*/
public JsonObject toJson() {
JsonObject json = new JsonObject();
NetworkOptionsConverter.toJson(this, json);
return json;
}

/** /**
* Return the TCP send buffer size, in bytes. * Return the TCP send buffer size, in bytes.
* *
Expand Down
75 changes: 74 additions & 1 deletion src/main/java/io/vertx/core/net/TCPSSLOptions.java
Expand Up @@ -128,6 +128,17 @@ public TCPSSLOptions(JsonObject json) {
TCPSSLOptionsConverter.fromJson(json ,this); TCPSSLOptionsConverter.fromJson(json ,this);
} }


/**
* Convert to JSON
*
* @return the JSON
*/
public JsonObject toJson() {
JsonObject json = super.toJson();
TCPSSLOptionsConverter.toJson(this, json);
return json;
}

private void init() { private void init() {
tcpNoDelay = DEFAULT_TCP_NO_DELAY; tcpNoDelay = DEFAULT_TCP_NO_DELAY;
tcpKeepAlive = DEFAULT_TCP_KEEP_ALIVE; tcpKeepAlive = DEFAULT_TCP_KEEP_ALIVE;
Expand Down Expand Up @@ -279,6 +290,15 @@ public TCPSSLOptions setKeyCertOptions(KeyCertOptions options) {
return this; return this;
} }


/**
* Get the key/cert options in jks format, aka Java keystore.
*
* @return the key/cert options in jks format, aka Java keystore.
*/
public JksOptions getKeyStoreOptions() {
return keyCertOptions instanceof JksOptions ? (JksOptions) keyCertOptions : null;
}

/** /**
* Set the key/cert options in jks format, aka Java keystore. * Set the key/cert options in jks format, aka Java keystore.
* @param options the key store in jks format * @param options the key store in jks format
Expand All @@ -289,6 +309,15 @@ public TCPSSLOptions setKeyStoreOptions(JksOptions options) {
return this; return this;
} }


/**
* Get the key/cert options in pfx format.
*
* @return the key/cert options in pfx format.
*/
public PfxOptions getPfxKeyCertOptions() {
return keyCertOptions instanceof PfxOptions ? (PfxOptions) keyCertOptions : null;
}

/** /**
* Set the key/cert options in pfx format. * Set the key/cert options in pfx format.
* @param options the key cert options in pfx format * @param options the key cert options in pfx format
Expand All @@ -299,6 +328,15 @@ public TCPSSLOptions setPfxKeyCertOptions(PfxOptions options) {
return this; return this;
} }


/**
* Get the key/cert store options in pem format.
*
* @return the key/cert store options in pem format.
*/
public PemKeyCertOptions getPemKeyCertOptions() {
return keyCertOptions instanceof PemKeyCertOptions ? (PemKeyCertOptions) keyCertOptions : null;
}

/** /**
* Set the key/cert store options in pem format. * Set the key/cert store options in pem format.
* @param options the options in pem format * @param options the options in pem format
Expand Down Expand Up @@ -327,7 +365,16 @@ public TCPSSLOptions setTrustOptions(TrustOptions options) {
} }


/** /**
* Set the trust options in jks format, aka Java trustore * Get the trust options in jks format, aka Java truststore
*
* @return the trust options in jks format, aka Java truststore
*/
public JksOptions getTrustStoreOptions() {
return trustOptions instanceof JksOptions ? (JksOptions) trustOptions : null;
}

/**
* Set the trust options in jks format, aka Java truststore
* @param options the trust options in jks format * @param options the trust options in jks format
* @return a reference to this, so the API can be used fluently * @return a reference to this, so the API can be used fluently
*/ */
Expand All @@ -336,6 +383,15 @@ public TCPSSLOptions setTrustStoreOptions(JksOptions options) {
return this; return this;
} }


/**
* Get the trust options in pfx format
*
* @return the trust options in pfx format
*/
public PfxOptions getPfxTrustOptions() {
return trustOptions instanceof PfxOptions ? (PfxOptions) trustOptions : null;
}

/** /**
* Set the trust options in pfx format * Set the trust options in pfx format
* @param options the trust options in pfx format * @param options the trust options in pfx format
Expand All @@ -346,6 +402,15 @@ public TCPSSLOptions setPfxTrustOptions(PfxOptions options) {
return this; return this;
} }


/**
* Get the trust options in pem format
*
* @return the trust options in pem format
*/
public PemTrustOptions getPemTrustOptions() {
return trustOptions instanceof PemTrustOptions ? (PemTrustOptions) trustOptions : null;
}

/** /**
* Set the trust options in pem format * Set the trust options in pem format
* @param options the trust options in pem format * @param options the trust options in pem format
Expand Down Expand Up @@ -452,10 +517,18 @@ public TCPSSLOptions setSslEngineOptions(SSLEngineOptions sslEngineOptions) {
return this; return this;
} }


public JdkSSLEngineOptions getJdkSslEngineOptions() {
return sslEngineOptions instanceof JdkSSLEngineOptions ? (JdkSSLEngineOptions) sslEngineOptions : null;
}

public TCPSSLOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) { public TCPSSLOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
return setSslEngineOptions(sslEngineOptions); return setSslEngineOptions(sslEngineOptions);
} }


public OpenSSLEngineOptions getOpenSslEngineOptions() {
return sslEngineOptions instanceof OpenSSLEngineOptions ? (OpenSSLEngineOptions) sslEngineOptions : null;
}

public TCPSSLOptions setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) { public TCPSSLOptions setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) {
return setSslEngineOptions(sslEngineOptions); return setSslEngineOptions(sslEngineOptions);
} }
Expand Down

0 comments on commit f56e788

Please sign in to comment.