io.vertx.ext.web.client.WebClientOptions.setDefaultHost()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中io.vertx.ext.web.client.WebClientOptions.setDefaultHost()方法的一些代码示例,展示了WebClientOptions.setDefaultHost()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClientOptions.setDefaultHost()方法的具体详情如下:
包路径:io.vertx.ext.web.client.WebClientOptions
类名称:WebClientOptions
方法名:setDefaultHost

WebClientOptions.setDefaultHost介绍

暂无

代码示例

代码示例来源:origin: io.vertx/vertx-consul-client

/**
 * Set the default host name 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 setDefaultHost(String defaultHost) {
 return (ConsulClientOptions) super.setDefaultHost(defaultHost);
}

代码示例来源: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

.setDefaultHost(elasticEdpt.getHost())
.setDefaultPort(elasticEdpt.getPort() != -1 ? elasticEdpt.getPort() :
    (HTTPS_SCHEME.equals(elasticEdpt.getScheme()) ? 443 : 80));

代码示例来源:origin: vert-x3/vertx-config

.setTrustAll(true)
.setSsl(configuration.getBoolean("ssl", true))
.setDefaultHost(host)
.setDefaultPort(port)
.setFollowRedirects(true)

代码示例来源:origin: vert-x3/vertx-service-discovery

.setTrustAll(true)
.setSsl(conf.getBoolean("ssl", true))
.setDefaultHost(host)
.setDefaultPort(port)
.setFollowRedirects(true)

代码示例来源: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());
 });
}

相关文章