Java 类org.springframework.http.client.reactive.ReactorClientHttpConnector 实例源码

项目:spring-vault    文件:ClientHttpConnectorFactory.java   
/**
 * Create a {@link ClientHttpConnector} for the given {@link ClientOptions} and
 * {@link SslConfiguration}.
 *
 * @param options must not be {@literal null}
 * @param sslConfiguration must not be {@literal null}
 * @return a new {@link ClientHttpConnector}.
 */
public static ClientHttpConnector create(ClientOptions options,
        SslConfiguration sslConfiguration) {

    return new ReactorClientHttpConnector(builder -> {

        if (hasSslConfiguration(sslConfiguration)) {

            builder.sslSupport(sslContextBuilder -> {
                configureSsl(sslConfiguration, sslContextBuilder);
            }).poolResources(
                    PoolResources.elastic("vault-http-"
                            + POOL_COUNTER.incrementAndGet()));
        }

        builder.sslHandshakeTimeout(options.getConnectionTimeout());
        builder.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
                Math.toIntExact(options.getConnectionTimeout().toMillis()));
    });
}
项目:reactive.loanbroker.system    文件:LoanBrokerTests.java   
@Before
public void setup(){
    request = mock(ServerRequest.class);
    serviceLocator = mock(ReactiveBankServiceLocator.class);
    reactorLoanBrokerAgent = new ReactorLoanBrokerAgent(serviceLocator,WebClient.create(new ReactorClientHttpConnector()));
    loanBrokerHandler = new LoanBrokerHandler(reactorLoanBrokerAgent);
}
项目:reactive-customer-service    文件:CustomerServiceTest.java   
private WebClient createSSLWebClient() throws IOException {

        /* Create a Reactor connector and tell it to trust our certificate */
        final File pemFile = pemResource.getFile();
        final ClientHttpConnector clientConnector = new ReactorClientHttpConnector(
                options -> options.sslSupport(builder -> builder.trustManager(pemFile)));

        /* Build a WebClient with the custom connector */
        return WebClient.builder()
                .baseUrl(String.format("https://127.0.0.1:%d", port))
                .clientConnector(clientConnector)
                .build();
    }
项目:spring-webflux-client    文件:DefaultRequestExecutorFactory.java   
@Override
public RequestExecutor build(ExtendedClientCodecConfigurer codecConfigurer, ExchangeFilterFunction exchangeFilterFunction) {
    ExchangeStrategies exchangeStrategies = ExtendedExchangeStrategies.of(codecConfigurer);
    WebClient webClient = WebClient
            .builder()
            .filters(exchangeFilterFunctions -> {
                if (exchangeFilterFunction != null) {
                    exchangeFilterFunctions.add(exchangeFilterFunction);
                }
            })
            .exchangeFunction(ExchangeFunctions.create(new ReactorClientHttpConnector(), exchangeStrategies))
            .build();

    return new DefaultRequestExecutor(webClient);
}
项目:spring-webflux-client    文件:DefaultRequestExecutorFactory.java   
@Override
public RequestExecutor build(ExtendedClientCodecConfigurer codecConfigurer, ExchangeFilterFunction exchangeFilterFunction) {
    ExchangeStrategies exchangeStrategies = ExtendedExchangeStrategies.of(codecConfigurer);
    WebClient webClient = WebClient
            .builder()
            .filters(exchangeFilterFunctions -> {
                if (exchangeFilterFunction != null) {
                    exchangeFilterFunctions.add(exchangeFilterFunction);
                }
            })
            .exchangeFunction(ExchangeFunctions.create(new ReactorClientHttpConnector(), exchangeStrategies))
            .build();

    return new DefaultRequestExecutor(webClient);
}
项目:spring-boot-admin    文件:InstanceWebClient.java   
private static WebClient createDefaultWebClient(Duration connectTimeout, Duration readTimeout) {
    ReactorClientHttpConnector connector = new ReactorClientHttpConnector(
            options -> options.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) connectTimeout.toMillis())//
                              .compression(true)//
                              .afterNettyContextInit(ctx -> {
                                  ctx.addHandlerLast(
                                          new ReadTimeoutHandler(readTimeout.toMillis(), TimeUnit.MILLISECONDS));
                              }));
    return WebClient.builder()
                    .clientConnector(connector)
                    .defaultHeader(HttpHeaders.ACCEPT, ActuatorMediaType.V2_JSON, ActuatorMediaType.V1_JSON,
                            MediaType.APPLICATION_JSON_VALUE)
                    .build();
}
项目:spring5demo    文件:GitterClient.java   
public GitterClient(GitterProperties config) {
    this.webClient = WebClient.builder().clientConnector(new ReactorClientHttpConnector()).build()
                              .filter(oAuthToken(config.getToken()));
}
项目:reactive.loanbroker.system    文件:Application.java   
@Bean
public WebClient webClient(){
    return WebClient.create(new ReactorClientHttpConnector());
}
项目:AngularAndSpring    文件:WebUtils.java   
public static WebClient buildWebClient(String url) {
    ReactorClientHttpConnector connector = new ReactorClientHttpConnector(
            options -> options.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000));
    return WebClient.builder().clientConnector(connector).baseUrl(url).build();
}
项目:AngularAndSpring    文件:ScheduledTask.java   
private WebClient buildWebClient(String url) {
    ReactorClientHttpConnector connector =
            new ReactorClientHttpConnector(options ->
                    options.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000));
    return WebClient.builder().clientConnector(connector).baseUrl(url).build();
}