• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Connector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
private static ApacheConnector getConnector(final Configurable<?> component) {
    if (!(component instanceof Initializable)) {
        throw new IllegalArgumentException(
                LocalizationMessages.INVALID_CONFIGURABLE_COMPONENT_TYPE(component.getClass().getName()));
    }

    final Initializable<?> initializable = (Initializable<?>) component;
    Connector connector = initializable.getConfiguration().getConnector();
    if (connector == null) {
        initializable.preInitialize();
        connector = initializable.getConfiguration().getConnector();
    }

    if (connector instanceof ApacheConnector) {
        return (ApacheConnector) connector;
    } else {
        throw new IllegalArgumentException(LocalizationMessages.EXPECTED_CONNECTOR_PROVIDER_NOT_USED());
    }
}
 
开发者ID:fod-dev,项目名称:FoDBugTrackerUtility,代码行数:20,代码来源:ApacheConnectorProvider.java


示例2: newRetryConnectorAllocator

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@VisibleForTesting
public static RetryConnectorAllocator newRetryConnectorAllocator()
{
    return new RetryConnectorAllocator()
    {
        @Override
        public RetryConnector newRetryConnector(Connector parentConnector, Retry retry)
        {
            return new RetryConnector(parentConnector, retry);
        }
    };
}
 
开发者ID:qubole,项目名称:qds-sdk-java,代码行数:13,代码来源:DefaultQdsConfiguration.java


示例3: testRetryAfterBadConnection

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Test
public void testRetryAfterBadConnection() throws Exception
{
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 100);

    final AtomicBoolean hadRetry = new AtomicBoolean(false);
    DefaultQdsConfiguration.RetryConnectorAllocator retryConnectorAllocator = new DefaultQdsConfiguration.RetryConnectorAllocator()
    {
        @Override
        public RetryConnector newRetryConnector(Connector parentConnector, Retry retry)
        {
            return new RetryConnector(parentConnector, retry)
            {
                @Override
                protected Future<?> internalApply(ClientRequest request, AsyncConnectorCallback callback, int tryCount)
                {
                    if ( tryCount > 0 )
                    {
                        if ( tryCount == 1 )
                        {
                            startServer(false);
                        }
                        hadRetry.set(true);
                    }
                    return super.internalApply(request, callback, tryCount);
                }
            };
        }
    };
    DefaultQdsConfiguration configuration = new DefaultQdsConfiguration("http://localhost:" + TEST_PORT, "bar", clientConfig, new StandardRetry(1000, 3), retryConnectorAllocator);
    QdsClient client = new QdsClientImpl(configuration);
    String value = client.command().logs("100").invoke().get();  // logs is set to retry
    Assert.assertTrue(hadRetry.get());
    Assert.assertEquals(value, TEST_VALUE);
}
 
开发者ID:qubole,项目名称:qds-sdk-java,代码行数:37,代码来源:TestRetries.java


示例4: testRetryAfterError

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Test
public void testRetryAfterError() throws Exception
{
    startServer(true);

    final AtomicBoolean hadRetry = new AtomicBoolean(false);
    DefaultQdsConfiguration.RetryConnectorAllocator retryConnectorAllocator = new DefaultQdsConfiguration.RetryConnectorAllocator()
    {
        @Override
        public RetryConnector newRetryConnector(Connector parentConnector, Retry retry)
        {
            return new RetryConnector(parentConnector, retry)
            {
                @Override
                protected Future<?> internalApply(ClientRequest request, AsyncConnectorCallback callback, int tryCount)
                {
                    if ( tryCount > 0 )
                    {
                        hadRetry.set(true);
                    }
                    return super.internalApply(request, callback, tryCount);
                }
            };
        }
    };
    DefaultQdsConfiguration configuration = new DefaultQdsConfiguration("http://localhost:" + TEST_PORT, "bar", new ClientConfig(), new StandardRetry(1000, 3), retryConnectorAllocator);
    QdsClient client = new QdsClientImpl(configuration);
    String value = client.command().logs("100").invoke().get();  // logs is set to retry
    Assert.assertTrue(hadRetry.get());
    Assert.assertEquals(value, TEST_VALUE);
}
 
开发者ID:qubole,项目名称:qds-sdk-java,代码行数:32,代码来源:TestRetries.java


示例5: createRESTClient

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
private Client createRESTClient(final DNSAPIClientConfig config,
		final ObjectMapper mapper, final SSLContextFactory sslContextFactory)
		throws Exception {
	final JacksonJsonProvider jacksonJsonProvider = new ErrorHandlingJacksonJsonProvider(
			mapper);

	final SSLContext sslContext = sslContextFactory.createSSLContext();
	final SSLSocketFactory sslSocketFactory = new SSLSocketFactory(
			sslContext);
	final SchemeRegistry schemeRegistry = createSchemeRegistry(config,
			sslSocketFactory);
	final HttpParams httpParams = createHttpParams();
	final PoolingClientConnectionManager clientConnectionManager = createPoolingClientConnectionManager(
			config, schemeRegistry);

	final ClientConfig clientConfig = createClientConfig(config,
			jacksonJsonProvider, httpParams, clientConnectionManager);
	final Connector connector = new ApacheConnector(clientConfig);
	clientConfig.connector(connector);
       final ApplicationProperties applicationProperties = new ApplicationProperties();
	clientConfig.register(new CsrfProtectionFilter(
			"DiscoveryDNS Reseller API Client v" + applicationProperties.getVersion()));
	final ClientBuilder clientBuilder = ClientBuilder.newBuilder();
	clientBuilder.withConfig(clientConfig);

	return clientBuilder.build();
}
 
开发者ID:discoverydns,项目名称:dnsapi-client,代码行数:28,代码来源:DNSAPIClientFactory.java


示例6: getConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Override
public Connector getConnector(final Client client, final Configuration runtime) {
    return new HttpComponentsConnector(apache, runtime);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:5,代码来源:HttpComponentsProvider.java


示例7: JerseyRetryConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
public JerseyRetryConnector(Connector connector, RetryComponents retryComponents)
{
    this.retryComponents = retryComponents;
    this.connector = connector;
}
 
开发者ID:soabase,项目名称:soabase,代码行数:6,代码来源:JerseyRetryConnector.java


示例8: getConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Override
public Connector getConnector(Client client, Configuration runtimeConfig)
{
    DropwizardApacheConnector dropwizardApacheConnector = new DropwizardApacheConnector(apacheHttpClient, RequestConfig.custom().build(), isChunkedEncodingEnabled);
    return new JerseyRetryConnector(dropwizardApacheConnector, retryComponents);
}
 
开发者ID:soabase,项目名称:soabase,代码行数:7,代码来源:JerseyRetryConnectorProvider.java


示例9: RetryConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
public RetryConnector(Connector connector, Retry retry)
{
    this.connector = connector;
    this.retry = retry;
}
 
开发者ID:qubole,项目名称:qds-sdk-java,代码行数:6,代码来源:RetryConnector.java


示例10: testFailure

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Test
public void testFailure() throws Exception
{
    ServerSocket server = new ServerSocket(TEST_PORT);  // make sure port is free
    server.close();

    ClientConfig clientConfig = new ClientConfig();
    clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 100);

    final AtomicBoolean hadRetry = new AtomicBoolean(false);
    DefaultQdsConfiguration.RetryConnectorAllocator retryConnectorAllocator = new DefaultQdsConfiguration.RetryConnectorAllocator()
    {
        @Override
        public RetryConnector newRetryConnector(Connector parentConnector, Retry retry)
        {
            return new RetryConnector(parentConnector, retry)
            {
                @Override
                protected Future<?> internalApply(ClientRequest request, AsyncConnectorCallback callback, int tryCount)
                {
                    if ( tryCount > 0 )
                    {
                        hadRetry.set(true);
                    }
                    return super.internalApply(request, callback, tryCount);
                }
            };
        }
    };
    DefaultQdsConfiguration configuration = new DefaultQdsConfiguration("http://localhost:" + TEST_PORT, "bar", clientConfig, new StandardRetry(1000, 3), retryConnectorAllocator);
    QdsClient client = new QdsClientImpl(configuration);
    try
    {
        client.command().status("100").invoke().get();  // status is set to retry
        Assert.fail("Should have thrown an exception");
    }
    catch ( ExecutionException e )
    {
        // expected
    }

    Assert.assertTrue(hadRetry.get());
}
 
开发者ID:qubole,项目名称:qds-sdk-java,代码行数:44,代码来源:TestRetries.java


示例11: getConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Override
public Connector getConnector(final Client client, final Configuration config) {
	return new InMemoryServerConnector(this.baseUri, this.appHandler);
}
 
开发者ID:gtcGroup,项目名称:jped-parent-project,代码行数:5,代码来源:InMemoryServerConnector.java


示例12: getConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
@Override
public Connector getConnector(final Client client, final Configuration config) {
	return new CdiAwareInMemoryConnector(this.baseUri, this.appHandler);
}
 
开发者ID:gtcGroup,项目名称:jped-parent-project,代码行数:5,代码来源:CdiAwareInMemoryConnector.java


示例13: newRetryConnector

import org.glassfish.jersey.client.spi.Connector; //导入依赖的package包/类
public RetryConnector newRetryConnector(Connector parentConnector, Retry retry); 
开发者ID:qubole,项目名称:qds-sdk-java,代码行数:2,代码来源:DefaultQdsConfiguration.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleCommand类代码示例发布时间:2022-05-23
下一篇:
Java Value类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap