當前位置: 首頁>>代碼示例>>Java>>正文


Java JerseyClientConfiguration類代碼示例

本文整理匯總了Java中io.dropwizard.client.JerseyClientConfiguration的典型用法代碼示例。如果您正苦於以下問題:Java JerseyClientConfiguration類的具體用法?Java JerseyClientConfiguration怎麽用?Java JerseyClientConfiguration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JerseyClientConfiguration類屬於io.dropwizard.client包,在下文中一共展示了JerseyClientConfiguration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: TestPolicyConfiguration

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
private TestPolicyConfiguration(
        JerseyClientConfiguration httpClient,
        ServiceInfoConfiguration serviceInfo,
        ClientTrustStoreConfiguration clientTrustStoreConfiguration,

        Duration timeoutPeriod,
        Duration matchingServiceResponseWaitPeriod,
        Duration assertionLifetime) {

    this.eventSinkUri = URI.create("http://event-sink");
    this.samlEngineUri = URI.create("http://saml-engine");
    this.samlSoapProxyUri = URI.create("http://saml-soap-proxy");
    this.httpClient = httpClient;
    this.serviceInfo = serviceInfo;
    this.clientTrustStoreConfiguration = clientTrustStoreConfiguration;

    this.timeoutPeriod = timeoutPeriod;
    this.matchingServiceResponseWaitPeriod = matchingServiceResponseWaitPeriod;
    this.assertionLifetime = assertionLifetime;
    this.configUri = URI.create("http://config");
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:22,代碼來源:PolicyConfigurationBuilder.java

示例3: 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

示例4: BaseClient

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
public BaseClient(Environment environment, ClientConfiguration clientConfiguration,
                        JerseyClientConfiguration jerseyClientConfiguration, String clientName) {
    httpClient = new JerseyClientBuilder(environment)
            .using(jerseyClientConfiguration)
            .build(clientName);

    StringBuilder targetBuilder = new StringBuilder();

    String target = targetBuilder.append(clientConfiguration.host)
            .append(':')
            .append(clientConfiguration.port)
            .append('/')
            .append(clientConfiguration.serviceContext).toString();

    webTarget = httpClient.target(target);
}
 
開發者ID:KainosSoftwareLtd,項目名稱:sample-dropwizard-service,代碼行數:17,代碼來源:BaseClient.java

示例5: run

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@Override
public void run() {
  CamundaProviderConfiguration camundaProviderConfiguration =
      (CamundaProviderConfiguration) providerConfiguration;

  JerseyClientConfiguration jerseyClientConfiguration =
      camundaProviderConfiguration.getJerseyClientConfiguration();

  jerseyClientConfiguration.setGzipEnabledForRequests(false);

  Client client =
      new JerseyClientBuilder(environment).using(
          camundaProviderConfiguration.getJerseyClientConfiguration()).build(
          "CamundaWorker" + threadNumber);

  WebTarget target = client.target(camundaProviderConfiguration.getEndpoint());

  Response response =
      target.request(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON_TYPE)
          .post(Entity.entity(EventUtils.toJson(event), MediaType.APPLICATION_JSON));

  if (response.getStatus() != 200)
    logger.error("Failed to send event to Camunda with HTTP error code: " + response.getStatus());
  else
    logger.info("Incident: {}", response.readEntity(String.class));
}
 
開發者ID:icclab,項目名稱:watchtower-workflow,代碼行數:27,代碼來源:CamundaProviderInstantiateWorkflowRunnable.java

示例6: run

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@Override
public void run(TestConfiguration configuration, Environment environment) throws Exception
{
    AbstractBinder binder = new AbstractBinder()
    {
        @Override
        protected void configure()
        {
            bind(throwInternalError).to(AtomicBoolean.class);
            bind(counter).to(AtomicInteger.class);
        }
    };
    environment.jersey().register(binder);
    environment.jersey().register(MockResource.class);

    JerseyClientConfiguration clientConfiguration = new JerseyClientConfiguration();
    clientConfiguration.setMaxConnectionsPerRoute(Integer.MAX_VALUE);
    clientConfiguration.setMaxConnections(Integer.MAX_VALUE);
    client = new ClientBuilder(environment).buildJerseyClient(clientConfiguration, "test");

    startedLatch.countDown();
}
 
開發者ID:soabase,項目名稱:soabase,代碼行數:23,代碼來源:MockApplication.java

示例7: BreakerboxServiceConfiguration

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@JsonCreator
public BreakerboxServiceConfiguration(@JsonProperty("azure") AzureTableConfiguration azure,
                                      @JsonProperty("tenacityClient") JerseyClientConfiguration tenacityClientConfiguration,
                                      @JsonProperty("breakerboxServicesPropertyKeys") TenacityConfiguration breakerboxServicesPropertyKeys,
                                      @JsonProperty("breakerboxServicesConfiguration") TenacityConfiguration breakerboxServicesConfiguration,
                                      @JsonProperty("breakerbox") BreakerboxConfiguration breakerboxConfiguration,
                                      @JsonProperty("ldap") LdapConfiguration ldapConfiguration,
                                      @JsonProperty("archaiusOverride") ArchaiusOverrideConfiguration archaiusOverride,
                                      @JsonProperty("database") JdbiConfiguration jdbiConfiguration,
                                      @JsonProperty("breakerboxHostAndPort") HostAndPort breakerboxHostAndPort,
                                      @JsonProperty("defaultDashboard") String defaultDashboard) {
    this.azure = Optional.fromNullable(azure);
    this.tenacityClient = tenacityClientConfiguration;
    this.breakerboxServicesPropertyKeys = Optional.fromNullable(breakerboxServicesPropertyKeys).or(new TenacityConfiguration());
    this.breakerboxServicesConfiguration = Optional.fromNullable(breakerboxServicesConfiguration).or(new TenacityConfiguration());
    this.breakerboxConfiguration = breakerboxConfiguration;
    this.ldapConfiguration = Optional.fromNullable(ldapConfiguration);
    this.archaiusOverride = Optional.fromNullable(archaiusOverride).or(new ArchaiusOverrideConfiguration());
    this.jdbiConfiguration = Optional.fromNullable(jdbiConfiguration);
    this.breakerboxHostAndPort = Optional.fromNullable(breakerboxHostAndPort).or(HostAndPort.fromParts("localhost", 20040));
    this.defaultDashboard = Optional.fromNullable(defaultDashboard).or("production");
}
 
開發者ID:guggens,項目名稱:log-dropwizard-eureka-mongo-sample,代碼行數:23,代碼來源:BreakerboxServiceConfiguration.java

示例8: 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

示例9: NullableMetadataConfiguration

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
public NullableMetadataConfiguration(String trustStorePath, String trustStorePassword, URI uri, Long minRefreshDelay, Long maxRefreshDelay, String expectedEntityId, JerseyClientConfiguration client, String jerseyClientName) {
    this.trustStorePath = trustStorePath;
    this.trustStorePassword = trustStorePassword;
    this.uri = uri;
    this.minRefreshDelay = minRefreshDelay;
    this.maxRefreshDelay = maxRefreshDelay;
    this.expectedEntityId = expectedEntityId;
    this.client = client;
    this.jerseyClientName = jerseyClientName;
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:11,代碼來源:NullableMetadataConfiguration.java

示例10: 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

示例11: setUpClient

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@BeforeClass
public static void setUpClient() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =  new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build
            (SamlMessageReceiverApiResourceTest.class.getSimpleName());
    eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode());
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:8,代碼來源:SamlMessageReceiverApiResourceTest.java

示例12: setUpClient

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@BeforeClass
public static void setUpClient() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =  new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build
            (SamlMessageReceiverApiResourceEidasEnabledTest.class.getSimpleName());
    eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode());
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:8,代碼來源:SamlMessageReceiverApiResourceEidasEnabledTest.java

示例13: setUpClient

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@BeforeClass
public static void setUpClient() throws Exception {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client =  new JerseyClientBuilder(samlProxyAppRule.getEnvironment()).using(jerseyClientConfiguration).build
            (SamlMessageReceiverApiResourceEidasDisabledTest.class.getSimpleName());
    eventSinkStubRule.register(Urls.HubSupportUrls.HUB_SUPPORT_EVENT_SINK_RESOURCE, Response.Status.OK.getStatusCode());
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:8,代碼來源:SamlMessageReceiverApiResourceEidasDisabledTest.java

示例14: beforeClass

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@BeforeClass
public static void beforeClass() throws Exception {
    IdaSamlBootstrap.bootstrap();
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(policy.getEnvironment())
        .using(jerseyClientConfiguration)
        .build(EidasSessionResourceContractTest.class.getSimpleName());
    sessionId = SessionId.createNewSessionId();
    samlAuthnResponseContainerDto = createAuthnResponseSignedByKeyPair(sessionId, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_CERT, TestCertificateStrings.STUB_IDP_PUBLIC_PRIMARY_PRIVATE_KEY);
    encryptedIdentityAssertion = AssertionBuilder.anAssertion().withId(UUID.randomUUID().toString()).build();
    encryptedIdentityAssertionString = XML_OBJECT_XML_OBJECT_TO_BASE_64_ENCODED_STRING_TRANSFORMER.apply(encryptedIdentityAssertion);
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:13,代碼來源:EidasSessionResourceContractTest.java

示例15: beforeClass

import io.dropwizard.client.JerseyClientConfiguration; //導入依賴的package包/類
@BeforeClass
public static void beforeClass() {
    JerseyClientConfiguration jerseyClientConfiguration = JerseyClientConfigurationBuilder.aJerseyClientConfiguration().withTimeout(Duration.seconds(10)).build();
    client = new JerseyClientBuilder(policy.getEnvironment())
            .using(jerseyClientConfiguration)
            .build(EidasSessionResourceIntegrationTest.class.getSimpleName());
}
 
開發者ID:alphagov,項目名稱:verify-hub,代碼行數:8,代碼來源:EidasSessionResourceIntegrationTest.java


注:本文中的io.dropwizard.client.JerseyClientConfiguration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。