当前位置: 首页>>代码示例>>Java>>正文


Java ProxyOptions类代码示例

本文整理汇总了Java中io.vertx.core.net.ProxyOptions的典型用法代码示例。如果您正苦于以下问题:Java ProxyOptions类的具体用法?Java ProxyOptions怎么用?Java ProxyOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProxyOptions类属于io.vertx.core.net包,在下文中一共展示了ProxyOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initWebClient

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
private WebClient initWebClient() {
	if (this.client == null) {
		final WebClientOptions wco = new WebClientOptions();
		final String proxyHost = this.getConsumerConfig().getProxy();
		final int proxyPort = this.getConsumerConfig().getProxyPort();
		if ((proxyHost != null) && (proxyPort > 0)) {
			final ProxyOptions po = new ProxyOptions();
			wco.setProxyOptions(po);
			po.setHost(proxyHost).setPort(proxyPort);
		}
		// TODO: more options
		wco.setUserAgent("SFDC VertX REST Provider");
		wco.setTryUseCompression(true);
		this.client = WebClient.create(this.vertx, wco);
	}
	return this.client;
}
 
开发者ID:Stwissel,项目名称:vertx-sfdc-platformevents,代码行数:18,代码来源:RestConsumer.java

示例2: login

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
protected void login(final Future<AuthInfo> futureAuthinfo) {
	final WebClientOptions wco = new WebClientOptions();
	final String proxyHost = this.getAuthConfig().getProxy();
	final int proxyPort = this.getAuthConfig().getProxyPort();
	if ((proxyHost != null) && (proxyPort > 0)) {
		final ProxyOptions po = new ProxyOptions();
		wco.setProxyOptions(po);
		po.setHost(proxyHost).setPort(proxyPort);
	}
	wco.setUserAgent("SDFC VertX Authenticator");
	wco.setTryUseCompression(true);
	final WebClient authClient = WebClient.create(this.vertx, wco);
	final Buffer body = this.getAuthBody(this.getAuthConfig().getSfdcUser(),
			this.getAuthConfig().getSfdcPassword());
	if (!this.shuttingDown && !this.shutdownCompleted) {
		authClient.post(Constants.TLS_PORT, this.getAuthConfig().getServerURL(), Constants.AUTH_SOAP_LOGIN)
				.putHeader("Content-Type", "text/xml").ssl(true).putHeader("SOAPAction", "Login")
				.putHeader("PrettyPrint", "Yes").sendBuffer(body, postReturn -> {
					this.resultOfAuthentication(postReturn, futureAuthinfo);
				});
	} else {
		this.shutdownCompleted = true;
		futureAuthinfo.fail("Auth disruped by stop command");
	}
}
 
开发者ID:Stwissel,项目名称:vertx-sfdc-platformevents,代码行数:27,代码来源:SoapApi.java

示例3: createHttpClientOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
public HttpClientOptions createHttpClientOptions() {
  HttpVersion ver = ServiceRegistryConfig.INSTANCE.getHttpVersion();
  HttpClientOptions httpClientOptions = new HttpClientOptions();
  httpClientOptions.setProtocolVersion(ver);
  httpClientOptions.setConnectTimeout(ServiceRegistryConfig.INSTANCE.getConnectionTimeout());
  httpClientOptions.setIdleTimeout(ServiceRegistryConfig.INSTANCE.getIdleConnectionTimeout());
  if (ServiceRegistryConfig.INSTANCE.isProxyEnable()) {
    ProxyOptions proxy = new ProxyOptions();
    proxy.setHost(ServiceRegistryConfig.INSTANCE.getProxyHost());
    proxy.setPort(ServiceRegistryConfig.INSTANCE.getProxyPort());
    proxy.setUsername(ServiceRegistryConfig.INSTANCE.getProxyUsername());
    proxy.setPassword(ServiceRegistryConfig.INSTANCE.getProxyPasswd());
    httpClientOptions.setProxyOptions(proxy);
  }
  if (ver == HttpVersion.HTTP_2) {
    LOGGER.debug("service center client protocol version is HTTP/2");
    httpClientOptions.setHttp2ClearTextUpgrade(false);
  }
  if (ServiceRegistryConfig.INSTANCE.isSsl()) {
    LOGGER.debug("service center client performs requests over TLS");
    VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions);
  }
  return httpClientOptions;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:26,代码来源:HttpClientPool.java

示例4: initWebClient

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
private WebClient initWebClient() {
	if (this.client == null) {
		final WebClientOptions wco = new WebClientOptions();
		final String proxyHost = this.getListenerConfig().getProxy();
		final int proxyPort = this.getListenerConfig().getProxyPort();
		if ((proxyHost != null) && (proxyPort > 0)) {
			final ProxyOptions po = new ProxyOptions();
			wco.setProxyOptions(po);
			po.setHost(proxyHost).setPort(proxyPort);
		}
		// TODO: more options
		wco.setUserAgent("SDFC VertX EventBus Client");
		wco.setTryUseCompression(true);
		this.client = WebClient.create(this.vertx, wco);
	}
	return this.client;
}
 
开发者ID:Stwissel,项目名称:vertx-sfdc-platformevents,代码行数:18,代码来源:CometD.java

示例5: httpClientOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Bean
public HttpClientOptions httpClientOptions() {

    final HttpClientOptions options = new HttpClientOptions()
        .setPipelining(true);
    if (httpClientProxyHost != null) {
        final ProxyOptions proxyOptions = new ProxyOptions()
            .setHost(httpClientProxyHost)
            .setPort(httpClientProxyPort)
            .setType(httpClientProxyType)
            .setUsername(httpClientProxyUsername)
            .setPassword(httpClientProxyPassword);
        options.setProxyOptions(proxyOptions);
    }
    return options;
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:17,代码来源:VertxConfig.java

示例6: load

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
public void load(Handler<AsyncResult<Void>> resultHandler) {
    WebClientOptions options = new WebClientOptions();
    if (!"none".equalsIgnoreCase(PROXY_HOST)) {
        options.setProxyOptions(new ProxyOptions()
                .setType(ProxyType.HTTP)
                .setHost(PROXY_HOST)
                .setPort(PROXY_PORT));
    }
    String wellKnownUrl = this.config.getWellKnownUrl();
    WebClient.create(this.vertx, options)
            .getAbs(wellKnownUrl)
            .ssl(wellKnownUrl.startsWith("https://") ? true : false)
            .send(ar -> {
                if (ar.succeeded()) {
                    JsonObject response = Optional.ofNullable(ar.result().bodyAsJsonObject()).orElseGet(JsonObject::new);
                    this.parseAndStoreWellKnownFields(response, resultHandler);
                } else {
                    LOG.error("Unable to retrieve well known fields from {}", wellKnownUrl, ar.cause());
                    resultHandler.handle(Future.failedFuture(ar.cause()));
                }
            });
}
 
开发者ID:Deutsche-Boerse-Risk,项目名称:DAVe,代码行数:23,代码来源:JWKSAuthProviderImpl.java

示例7: initWebClientOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
private WebClientOptions initWebClientOptions(Request request) {

        WebClientOptions options = new WebClientOptions();
        options.setKeepAlive(true).setReuseAddress(true);

        if (Preconditions.isNotBlank(request.getUserAgent())) {
            options.setUserAgent(request.getUserAgent());
        }

        if (Preconditions.isNotBlank(request.getUrl())) {
            try {
                url = new URL(request.getUrl());
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }

        if (Preconditions.isNotBlank(request.getProxy())) {

            ProxyOptions proxyOptions = new ProxyOptions();
            proxyOptions.setHost(request.getProxy().getIp());
            proxyOptions.setPort(request.getProxy().getPort());
            options.setProxyOptions(proxyOptions);
        }

        if (Preconditions.isNotBlank(request.getHeader())) {

            header = request.getHeader();
        }

        return options;
    }
 
开发者ID:fengzhizi715,项目名称:NetDiscovery,代码行数:33,代码来源:VertxDownloader.java

示例8: withProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
private static HttpClientOptions withProxyOptions (HttpClientOptions options) {
  String https_proxy = System.getenv ("https_proxy");
  if (StringUtils.isNotEmpty (https_proxy)) {
    URI proxy = URI.create (https_proxy);
    options.setProxyOptions (new ProxyOptions ().setHost (proxy.getHost ()).setPort (proxy.getPort ()));
  }
  return options;
}
 
开发者ID:sonyxperiadev,项目名称:lumber-mill,代码行数:9,代码来源:SimpleGraphiteClient.java

示例9: setProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
public PgConnectOptions setProxyOptions(ProxyOptions proxyOptions) {
  return (PgConnectOptions)super.setProxyOptions(proxyOptions);
}
 
开发者ID:vietj,项目名称:reactive-pg-client,代码行数:5,代码来源:PgConnectOptions.java

示例10: getProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
public ProxyOptions getProxyOptions() {
    return proxyOptions;
}
 
开发者ID:flicus,项目名称:vertx-telegram-bot-api,代码行数:4,代码来源:TelegramOptions.java

示例11: setProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
public TelegramOptions setProxyOptions(ProxyOptions proxyOptions) {
    this.proxyOptions = proxyOptions;
    return this;
}
 
开发者ID:flicus,项目名称:vertx-telegram-bot-api,代码行数:5,代码来源:TelegramOptions.java

示例12: doStart

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
protected void doStart() throws Exception {
    // TODO: Prepare HttpClientOptions according to the endpoint to improve performance when creating a new
    // instance of the Vertx client
    httpClientOptions = new HttpClientOptions();

    httpClientOptions.setPipelining(endpoint.getHttpClientOptions().isPipelining());
    httpClientOptions.setKeepAlive(endpoint.getHttpClientOptions().isKeepAlive());
    httpClientOptions.setIdleTimeout((int) (endpoint.getHttpClientOptions().getIdleTimeout() / 1000));
    httpClientOptions.setConnectTimeout((int) endpoint.getHttpClientOptions().getConnectTimeout());
    httpClientOptions.setUsePooledBuffers(true);
    httpClientOptions.setMaxPoolSize(endpoint.getHttpClientOptions().getMaxConcurrentConnections());
    httpClientOptions.setTryUseCompression(endpoint.getHttpClientOptions().isUseCompression());

    // Configure proxy
    HttpProxy proxy = endpoint.getHttpProxy();
    if (proxy != null && proxy.isEnabled()) {
        ProxyOptions proxyOptions = new ProxyOptions();
        proxyOptions.setHost(proxy.getHost());
        proxyOptions.setPort(proxy.getPort());
        proxyOptions.setUsername(proxy.getUsername());
        proxyOptions.setPassword(proxy.getPassword());
        proxyOptions.setType(ProxyType.valueOf(proxy.getType().name()));

        httpClientOptions.setProxyOptions(proxyOptions);
    }

    URI target = URI.create(endpoint.getTarget());
    // Configure SSL
    HttpClientSslOptions sslOptions = endpoint.getHttpClientSslOptions();
    if (sslOptions != null && sslOptions.isEnabled()) {
        httpClientOptions
                .setSsl(sslOptions.isEnabled())
                .setVerifyHost(sslOptions.isHostnameVerifier())
                .setTrustAll(sslOptions.isTrustAll());

        if (sslOptions.getPem() != null && ! sslOptions.getPem().isEmpty()) {
            httpClientOptions.setPemTrustOptions(
                    new PemTrustOptions().addCertValue(
                            io.vertx.core.buffer.Buffer.buffer(sslOptions.getPem())));
        }
    } else if(HTTPS_SCHEME.equalsIgnoreCase(target.getScheme())) {
        // SSL is not configured but the endpoint scheme is HTTPS so let's enable the SSL on Vert.x HTTP client
        // automatically
        httpClientOptions.setSsl(true).setTrustAll(true);
    }

    printHttpClientConfiguration(httpClientOptions);
}
 
开发者ID:gravitee-io,项目名称:gravitee-gateway,代码行数:50,代码来源:VertxHttpClient.java

示例13: setProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
public AmqpBridgeOptions setProxyOptions(ProxyOptions proxyOptions) {
  super.setProxyOptions(proxyOptions);
  return this;
}
 
开发者ID:vert-x3,项目名称:vertx-amqp-bridge,代码行数:6,代码来源:AmqpBridgeOptions.java

示例14: setProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
public ProtonClientOptions setProxyOptions(ProxyOptions proxyOptions) {
  super.setProxyOptions(proxyOptions);
  return this;
}
 
开发者ID:vert-x3,项目名称:vertx-proton,代码行数:6,代码来源:ProtonClientOptions.java

示例15: setProxyOptions

import io.vertx.core.net.ProxyOptions; //导入依赖的package包/类
@Override
public WebClientOptions setProxyOptions(ProxyOptions proxyOptions) {
  return (WebClientOptions) super.setProxyOptions(proxyOptions);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:5,代码来源:WebClientOptions.java


注:本文中的io.vertx.core.net.ProxyOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。