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


Java JerseyClientConfiguration.setTimeout方法代码示例

本文整理汇总了Java中io.dropwizard.client.JerseyClientConfiguration.setTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java JerseyClientConfiguration.setTimeout方法的具体用法?Java JerseyClientConfiguration.setTimeout怎么用?Java JerseyClientConfiguration.setTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.dropwizard.client.JerseyClientConfiguration的用法示例。


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

示例1: getNewSecureClient

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
protected Client getNewSecureClient(String keyStoreResourcePath) throws Exception {
    TlsConfiguration tlsConfiguration = new TlsConfiguration();
    tlsConfiguration.setKeyStorePath(new File(resourceFilePath(keyStoreResourcePath)));
    tlsConfiguration.setKeyStorePassword("notsecret");

    tlsConfiguration.setTrustStorePath(new File(resourceFilePath("tls/test-truststore.jks")));
    tlsConfiguration.setTrustStorePassword("notsecret");

    tlsConfiguration.setVerifyHostname(false);

    tlsConfiguration.setSupportedCiphers(Lists.newArrayList("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"));
    tlsConfiguration.setSupportedProtocols(Lists.newArrayList("TLSv1.2"));

    JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTlsConfiguration(tlsConfiguration);
    configuration.setTimeout(Duration.seconds(30));
    configuration.setConnectionTimeout(Duration.seconds(30));
    configuration.setConnectionRequestTimeout(Duration.seconds(30));

    return new JerseyClientBuilder(USER_INFO_APP_RULE.getEnvironment())
            .using(configuration)
            .build(UUID.randomUUID().toString());
}
 
开发者ID:wdawson,项目名称:dropwizard-auth-example,代码行数:24,代码来源:IntegrationTest.java

示例2: getDefaultJerseyClientConfiguration

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
public static JerseyClientConfiguration getDefaultJerseyClientConfiguration(boolean verifyHostname, boolean trustSelfSignedCertificates) {
    JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
    jerseyClientConfiguration.setTimeout(Duration.seconds(60));
    jerseyClientConfiguration.setTimeToLive(Duration.minutes(10));
    jerseyClientConfiguration.setCookiesEnabled(false);
    jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(4));
    jerseyClientConfiguration.setRetries(3);
    jerseyClientConfiguration.setKeepAlive(Duration.seconds(60));
    jerseyClientConfiguration.setChunkedEncodingEnabled(false);
    jerseyClientConfiguration.setValidateAfterInactivityPeriod(Duration.seconds(5));
    TlsConfiguration tlsConfiguration = new TlsConfiguration();
    tlsConfiguration.setProtocol("TLSv1.2");
    tlsConfiguration.setVerifyHostname(verifyHostname);
    tlsConfiguration.setTrustSelfSignedCertificates(trustSelfSignedCertificates);
    jerseyClientConfiguration.setTlsConfiguration(tlsConfiguration);
    jerseyClientConfiguration.setGzipEnabledForRequests(false);
    return jerseyClientConfiguration;
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:19,代码来源:MatchingServiceAdapterConfiguration.java

示例3: createClient

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void createClient() {
    final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTimeout(Duration.minutes(1L));
    configuration.setConnectionTimeout(Duration.minutes(1L));
    configuration.setConnectionRequestTimeout(Duration.minutes(1L));
    this.client = new JerseyClientBuilder(this.RULE.getEnvironment()).using(configuration)
            .build("test client");

    assertThat(this.client
            .target(String.format(CREDENTIAL_END_POINT, this.RULE.getLocalPort()))
            .request()
            .header(X_AUTH_RSA_HEADER, BASE_64_PUBLIC_KEY)
            .post(Entity.json(this.credential)).getStatus())
                    .isEqualTo(Status.CREATED.getStatusCode());
}
 
开发者ID:mtakaki,项目名称:CredentialStorageService,代码行数:17,代码来源:CredentialStorageApplicationTest.java

示例4: setUp

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
    jerseyClientConfiguration.setConnectionTimeout(Duration.seconds(10));
    jerseyClientConfiguration.setTimeout(Duration.seconds(10));
    client = new JerseyClientBuilder(samlProxyAppRule.getEnvironment())
            .using(jerseyClientConfiguration)
            .build(HubMetadataIntegrationTests.class.getName());
    DateTimeFreezer.freezeTime();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:11,代码来源:HubMetadataIntegrationTests.java

示例5: setupClass

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@BeforeClass
    public static void setupClass() {
        // We need to enable typing otherwise abstract types, e.g. ExpressionItem, won't be deserialisable.
        RULE.getEnvironment().getObjectMapper().enableDefaultTyping();
        app = RULE.getApplication();
        JerseyClientConfiguration clientConfiguration = new JerseyClientConfiguration();
        clientConfiguration.setConnectionRequestTimeout(io.dropwizard.util.Duration.seconds(10));
        clientConfiguration.setConnectionTimeout(io.dropwizard.util.Duration.seconds(10));
        clientConfiguration.setTimeout(Duration.seconds(10));
        client = new JerseyClientBuilder(RULE.getEnvironment())
                .using(clientConfiguration)
                .build("test client");
        APPLICATION_PORT = RULE.getLocalPort();
        ADMIN_PORT = RULE.getAdminPort();

//        STATISTICS_URL = String.format("http://localhost:%d/statistics", APPLICATION_PORT);
        QUERY_SEARCH_URL = String.format("http://localhost:%d" +
                ResourcePaths.ROOT_PATH +
                ResourcePaths.STROOM_STATS +
                ResourcePaths.V2 +
                QueryResource.SEARCH_ENDPOINT, APPLICATION_PORT);

        BASE_TASKS_URL = String.format("http://localhost:%d/tasks/", ADMIN_PORT);
        HEALTH_CHECKS_URL = String.format("http://localhost:%d/admin/healthcheck?pretty=true", ADMIN_PORT);
        START_PROCESSING_URL = BASE_TASKS_URL + "startProcessing";
        STOP_PROCESSING_URL = BASE_TASKS_URL + "stopProcessing";

        LOGGER.info("Query url:            {}", QUERY_SEARCH_URL);
        LOGGER.info("Health checks url:    {}", HEALTH_CHECKS_URL);
        LOGGER.info("Start processing url: {}, e.g. curl -X POST {}", START_PROCESSING_URL, START_PROCESSING_URL);
        LOGGER.info("Stop processing url:  {}, e.g. curl -X POST {}", STOP_PROCESSING_URL, STOP_PROCESSING_URL);
    }
 
开发者ID:gchq,项目名称:stroom-stats,代码行数:33,代码来源:AbstractAppIT.java

示例6: buildClient

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
private static Client buildClient(JerseyClientBuilder clientBuilder) {
    final JerseyClientConfiguration jerseyConfig = new JerseyClientConfiguration();
    jerseyConfig.setConnectionTimeout(Duration.milliseconds(500));
    jerseyConfig.setKeepAlive(Duration.minutes(5));
    jerseyConfig.setMaxConnections(2048);
    jerseyConfig.setMaxConnectionsPerRoute(2048);
    jerseyConfig.setTimeout(Duration.hours(1));
    jerseyConfig.setTimeToLive(Duration.minutes(5));

    final JerseyClientBuilder builder = clientBuilder != null ? clientBuilder : new JerseyClientBuilder(new MetricRegistry());

    return builder
        .using(Executors.newSingleThreadExecutor(), new ObjectMapper())
        .using(jerseyConfig).build("SECPClient");
}
 
开发者ID:tosinoni,项目名称:SECP,代码行数:16,代码来源:SECPClient.java

示例7: setup

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
    final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTimeout(Duration.minutes(1L));
    configuration.setConnectionTimeout(Duration.minutes(1L));

    this.client = new CredentialStorageServiceClient(
            new File("./src/test/resources/private_key.der"),
            new File("./src/test/resources/public_key.der"),
            String.format("http://localhost:%d/", this.RULE.getLocalPort()),
            configuration);
}
 
开发者ID:mtakaki,项目名称:CredentialStorageServiceClient,代码行数:13,代码来源:CredentialStorageServiceClientIntegrationTest.java

示例8: createTestJerseyClient

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
public static Client createTestJerseyClient(Duration timeout) {
    Environment environment = new Environment("test-dropwizard-apache-connector", Jackson.newObjectMapper(),
            buildDefaultValidatorFactory().getValidator(), new MetricRegistry(),
            TestJerseyClientBuilder.class.getClassLoader());

    JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTimeout(timeout);
    return new JerseyClientBuilder(environment).using(configuration).build("test-jersey-client");
}
 
开发者ID:openregister,项目名称:openregister-java,代码行数:10,代码来源:TestJerseyClientBuilder.java

示例9: createClient

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void createClient() {
    final JerseyClientConfiguration configuration = new JerseyClientConfiguration();
    configuration.setTimeout(Duration.minutes(1L));
    configuration.setConnectionTimeout(Duration.minutes(1L));
    configuration.setConnectionRequestTimeout(Duration.minutes(1L));
    this.client = new JerseyClientBuilder(this.RULE.getEnvironment()).using(configuration)
            .build("test client");
}
 
开发者ID:mtakaki,项目名称:dropwizard-hikaricp,代码行数:10,代码来源:ManagedPooledDataSourceTest.java

示例10: setupClient

import io.dropwizard.client.JerseyClientConfiguration; //导入方法依赖的package包/类
@Before
public void setupClient() {
    final JerseyClientConfiguration jerseyClientConfiguration = new JerseyClientConfiguration();
    jerseyClientConfiguration.setConnectionTimeout(Duration.minutes(1L));
    jerseyClientConfiguration.setConnectionRequestTimeout(Duration.minutes(1L));
    jerseyClientConfiguration.setTimeout(Duration.minutes(1L));
    client = new JerseyClientBuilder(this.RULE.getEnvironment())
            .using(jerseyClientConfiguration)
            .withProperty(ClientProperties.FOLLOW_REDIRECTS, Boolean.FALSE)
            .build("test client");
}
 
开发者ID:mtakaki,项目名称:dropwizard-circuitbreaker,代码行数:12,代码来源:CircuitBreakerBundleIntegrationTest.java


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