本文整理了Java中io.vertx.ext.web.client.WebClientOptions.setDefaultPort()
方法的一些代码示例,展示了WebClientOptions.setDefaultPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClientOptions.setDefaultPort()
方法的具体详情如下:
包路径:io.vertx.ext.web.client.WebClientOptions
类名称:WebClientOptions
方法名:setDefaultPort
暂无
代码示例来源:origin: io.vertx/vertx-consul-client
/**
* Set the default port to be used by this client in requests if none is provided when making the request.
*
* @return a reference to this, so the API can be used fluently
*/
@Override
public ConsulClientOptions setDefaultPort(int defaultPort) {
return (ConsulClientOptions) super.setDefaultPort(defaultPort);
}
代码示例来源:origin: vert-x3/vertx-config
/**
* Creates an instance of {@link SlimVaultClient}.
*
* @param vertx the vert.x instance
* @param configuration the configuration. This configuration can contain the underlying Web Client configuration.
*/
public SlimVaultClient(Vertx vertx, JsonObject configuration) {
String host = configuration.getString("host");
Integer port = configuration.getInteger("port", 8200);
Objects.requireNonNull(host, "The Vault host must be set");
client = WebClient.create(vertx, new WebClientOptions(configuration)
.setDefaultPort(port).setDefaultHost(host)
);
setToken(configuration.getString("token"));
}
代码示例来源:origin: io.gravitee.elasticsearch/gravitee-common-elasticsearch
.setUsePooledBuffers(true)
.setDefaultHost(elasticEdpt.getHost())
.setDefaultPort(elasticEdpt.getPort() != -1 ? elasticEdpt.getPort() :
(HTTPS_SCHEME.equals(elasticEdpt.getScheme()) ? 443 : 80));
代码示例来源:origin: vert-x3/vertx-config
.setSsl(configuration.getBoolean("ssl", true))
.setDefaultHost(host)
.setDefaultPort(port)
.setFollowRedirects(true)
);
代码示例来源:origin: vert-x3/vertx-service-discovery
.setSsl(conf.getBoolean("ssl", true))
.setDefaultHost(host)
.setDefaultPort(port)
.setFollowRedirects(true)
);
代码示例来源:origin: io.vertx/vertx-web-client
@Test
public void testToJson() {
WebClientOptions options = new WebClientOptions()
.setDefaultPort(4848)
.setMaxPoolSize(50)
.setUserAgentEnabled(false);
JsonObject json = options.toJson();
assertEquals(4848, (int) json.getInteger("defaultPort"));
assertEquals(50, (int) json.getInteger("maxPoolSize"));
assertEquals(false, json.getBoolean("userAgentEnabled"));
}
}
代码示例来源:origin: io.vertx/vertx-web-client
private void testTLS(boolean clientSSL, boolean serverSSL, Function<WebClient, HttpRequest<Buffer>> requestProvider, Consumer<HttpServerRequest> serverAssertions) throws Exception {
WebClientOptions clientOptions = new WebClientOptions()
.setSsl(clientSSL)
.setTrustAll(true)
.setDefaultHost(DEFAULT_HTTPS_HOST)
.setDefaultPort(DEFAULT_HTTPS_PORT);
HttpServerOptions serverOptions = new HttpServerOptions()
.setSsl(serverSSL)
.setKeyStoreOptions(Cert.SERVER_JKS.get())
.setPort(DEFAULT_HTTPS_PORT)
.setHost(DEFAULT_HTTPS_HOST);
testTLS(clientOptions, serverOptions, requestProvider, serverAssertions);
}
代码示例来源:origin: io.vertx/vertx-web-client
@Test
public void testVirtualHostSNI() throws Exception {
WebClientOptions clientOptions = new WebClientOptions()
.setTrustAll(true)
.setDefaultHost(DEFAULT_HTTPS_HOST)
.setDefaultPort(DEFAULT_HTTPS_PORT);
HttpServerOptions serverOptions = new HttpServerOptions()
.setSsl(true)
.setSni(true)
.setKeyStoreOptions(Cert.SNI_JKS.get())
.setPort(DEFAULT_HTTPS_PORT)
.setHost(DEFAULT_HTTPS_HOST);
testTLS(clientOptions, serverOptions, req -> req.get("/").virtualHost("host2.com").ssl(true), req -> {
assertEquals("host2.com", req.connection().indicatedServerName());
System.out.println(req.host());
});
}
内容来源于网络,如有侵权,请联系作者删除!