本文整理汇总了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());
}
示例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");
}
示例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);
}
示例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));
}
示例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();
}
示例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());
}
示例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;
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}