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


Java ClientConfig.connectorProvider方法代码示例

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


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

示例1: Scim2Provisioner

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
public Scim2Provisioner(final String target, final String oauthToken,
                        final String username, final String password,
                        final Scim2PrincipalAttributeMapper mapper) {
    final ClientConfig config = new ClientConfig();
    final ApacheConnectorProvider connectorProvider = new ApacheConnectorProvider();
    config.connectorProvider(connectorProvider);
    final Client client = ClientBuilder.newClient(config);
    
    if (StringUtils.isNotBlank(oauthToken)) {
        client.register(OAuth2ClientSupport.feature(oauthToken));
    }
    if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
        client.register(HttpAuthenticationFeature.basic(username, password));
    }
    
    final WebTarget webTarget = client.target(target);
    this.scimService = new ScimService(webTarget);
    this.mapper = mapper;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:20,代码来源:Scim2Provisioner.java

示例2: ParaClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
/**
 * Default constructor.
 * @param accessKey app access key
 * @param secretKey app secret key
 */
public ParaClient(String accessKey, String secretKey) {
	this.accessKey = accessKey;
	this.secretKey = secretKey;
	if (StringUtils.length(secretKey) < 6) {
		logger.warn("Secret key appears to be invalid. Make sure you call 'signIn()' first.");
	}
	ClientConfig clientConfig = new ClientConfig();
	clientConfig.register(GenericExceptionMapper.class);
	clientConfig.register(new JacksonJsonProvider(ParaObjectUtils.getJsonMapper()));
	clientConfig.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());
	SSLContext sslContext = SslConfigurator.newInstance().securityProtocol("TLSv1").createSSLContext();
	System.setProperty("https.protocols", "TLSv1");
	apiClient = ClientBuilder.newBuilder().
			sslContext(sslContext).
			withConfig(clientConfig).build();
}
 
开发者ID:Erudika,项目名称:para,代码行数:22,代码来源:ParaClient.java

示例3: createClientConfig

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
protected ClientConfig createClientConfig() {
	ClientConfig config = new ClientConfig();
	if ( proxy != null && proxy.getUri() != null ) {
		config.property(ClientProperties.PROXY_URI, proxy.getUriString());
		config.property(ClientProperties.PROXY_USERNAME, proxy.getUserName());
		config.property(ClientProperties.PROXY_PASSWORD, proxy.getPassword());
	}
	config.property(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.BUFFERED);
	config.property(ApacheClientProperties.CREDENTIALS_PROVIDER, getCredentialsProvider());
	config.property(ApacheClientProperties.SERVICE_UNAVAILABLE_RETRY_STRATEGY, getServiceUnavailableRetryStrategy());
	config.property(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION, doPreemptiveBasicAuthentication());
	config.connectorProvider(new ApacheConnectorProvider());
	config.register(JacksonFeature.class);
	config.register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.FINE, LoggingFeature.Verbosity.PAYLOAD_ANY, 10000));
	return config;
}
 
开发者ID:fod-dev,项目名称:FoDBugTrackerUtility,代码行数:17,代码来源:RestConnection.java

示例4: createJaxrsClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private static javax.ws.rs.client.Client createJaxrsClient(
        final HttpClientConnectionManager connectionManager, final int connectionTimeout,
        final int socketTimeout, @Nullable final ProxyConfig proxy) {

    // Configure requests
    final RequestConfig requestConfig = RequestConfig.custom()//
            .setExpectContinueEnabled(false) //
            .setRedirectsEnabled(false) //
            .setConnectionRequestTimeout(connectionTimeout) //
            .setConnectTimeout(connectionTimeout) //
            .setSocketTimeout(socketTimeout)
            .build();

    // Configure client
    final ClientConfig config = new ClientConfig();
    config.connectorProvider(new ApacheConnectorProvider());
    config.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager);
    config.property(ApacheClientProperties.REQUEST_CONFIG, requestConfig);
    config.property(ApacheClientProperties.DISABLE_COOKIES, true); // not needed
    config.property(ClientProperties.REQUEST_ENTITY_PROCESSING,
            RequestEntityProcessing.CHUNKED); // required to stream data to the server
    if (proxy != null) {
        config.property(ClientProperties.PROXY_URI, proxy.getURL());
        config.property(ClientProperties.PROXY_USERNAME, proxy.getUsername());
        config.property(ClientProperties.PROXY_PASSWORD, proxy.getPassword());
    }

    // Register filter and custom serializer
    config.register(Serializer.class);
    config.register(GZipEncoder.class);

    // Create and return a configured JAX-RS client
    return ClientBuilder.newClient(config);
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:35,代码来源:Client.java

示例5: buildClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private static void buildClient() {
	if ( USE_PROXY ) {
		ClientConfig config = new ClientConfig();
		config.connectorProvider(new ApacheConnectorProvider());
		CredentialsProvider credentials = new BasicCredentialsProvider();
		credentials.setCredentials(AuthScope.ANY, new NTCredentials(PROXY_USER, PROXY_PASS, null, PROXY_DOMAIN));
		config.property(ApacheClientProperties.CREDENTIALS_PROVIDER, credentials);
		config.property(ClientProperties.PROXY_URI, PROXY_PROTOCOL + PROXY_SERVER);

		client = ClientBuilder.newClient(config);
	}
	else
		client = ClientBuilder.newClient();
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:15,代码来源:WebHelper.java

示例6: getInvocationBuilder

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
protected Builder getInvocationBuilder(String url, Map<String, String> queryParameters) {
		ClientConfig clientConfig = new ClientConfig();
		if (getProxyAddress() != null) {
			clientConfig.connectorProvider(new ApacheConnectorProvider());
			clientConfig.property(ClientProperties.PROXY_URI, getProxyAddress());
		}
		Client client = ClientBuilder.newClient(clientConfig);
		client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
		WebTarget webTarget = client.target(url);

		if (queryParameters != null) {
			for (Map.Entry<String, String> queryParameter: queryParameters.entrySet())
//				webTarget = webTarget.queryParam(queryParameter.getKey(), queryParameter.getValue().replace("_", "_1").replace("%",  "_0"));
				webTarget = webTarget.queryParam(queryParameter.getKey(), queryParameter.getValue());
		}

		
		return webTarget.request(MediaType.APPLICATION_JSON).accept("application/ld+json").header("Authorization", getCloudTokenValue());
	}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:20,代码来源:OEClientReadOnly.java

示例7: getClientConfig

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private ClientConfig getClientConfig()
{
    ClientConfig config = new ClientConfig();
    config.connectorProvider(new ApacheConnectorProvider());

    return config;
}
 
开发者ID:carlspring,项目名称:logback-configuration,代码行数:8,代码来源:TestClient.java

示例8: createConfig

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private ClientConfig createConfig() {
	ClientConfig config = new ClientConfig();
	config.connectorProvider(new ApacheConnectorProvider());

	JacksonJaxbJsonProvider jacksonProvider = new JacksonJaxbJsonProvider();
	jacksonProvider.setMapper(objectMapper);
	config.register(jacksonProvider);
	return config;
}
 
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:10,代码来源:ClientStarter.java

示例9: defaultClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private Client defaultClient() {
    int cores = Runtime.getRuntime().availableProcessors();
    ClientConfig config = new ClientConfig();
    config.connectorProvider(new GrizzlyConnectorProvider());
    config.property(ClientProperties.ASYNC_THREADPOOL_SIZE, cores);

    return ClientBuilder.newClient(config);
}
 
开发者ID:alex-shpak,项目名称:rx-jersey,代码行数:9,代码来源:RxJerseyClientFeature.java

示例10: getSymphonyClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
public static SymphonyClient getSymphonyClient(SymphonyClientConfig symphonyClientConfig) throws InitException, AuthenticationException {
    SymphonyClient symClient = SymphonyClientFactory.getClient(SymphonyClientFactory.TYPE.BASIC);
    String proxy = symphonyClientConfig.get("proxy.url");

    if (proxy == null) {
        symClient.init(symphonyClientConfig);
        return symClient;
    } else {
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.connectorProvider(new ApacheConnectorProvider());
        clientConfig.property(ClientProperties.PROXY_URI, proxy);

        try {
            Client httpClient = CustomHttpClient.getClient(
                    symphonyClientConfig.get(SymphonyClientConfigID.USER_CERT_FILE),
                    symphonyClientConfig.get(SymphonyClientConfigID.USER_CERT_PASSWORD),
                    symphonyClientConfig.get(SymphonyClientConfigID.TRUSTSTORE_FILE),
                    symphonyClientConfig.get(SymphonyClientConfigID.TRUSTSTORE_PASSWORD),
                    clientConfig);
            symClient.init(httpClient, symphonyClientConfig);
            return symClient;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return symClient;
}
 
开发者ID:symphonyoss,项目名称:symphony-java-sample-bots,代码行数:28,代码来源:Utils.java

示例11: buildClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private static JerseyClient buildClient(GuildWars2ApiConfig config) {
    ClientConfig jerseyConfig = config.getClientConfig();
    JerseyClientBuilder builder = new JerseyClientBuilder().withConfig(jerseyConfig);
    if (config.isGoDaddyFixEnabled()) {
        GoDaddyFix.insertFix(builder);
    }

    if (config.isApacheHttpClientEnabled()) {
        jerseyConfig.connectorProvider(new ApacheConnectorProvider());
    }
    return builder.build();
}
 
开发者ID:Nithanim,项目名称:gw2api,代码行数:13,代码来源:GuildWars2Api.java

示例12: buildClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private static Client buildClient(ClientConfiguration clientConfiguration) {
    ClientConfig clientConfig = new ClientConfig();
    clientConfig
            .register(JsonMappingExceptionMapper.class)
            .register(JsonParseExceptionMapper.class)
            .register(JacksonJaxbJsonProvider.class, new Class[]{MessageBodyReader.class, MessageBodyWriter.class})
            .register(RequestBodyLogger.class)
            .register(HttpAuthenticationFeature.basic(clientConfiguration.getUsername(), clientConfiguration.getPassword()))
    ;

    if (clientConfiguration.isEnableBatchCompression()) {
        clientConfig.register(GZipWriterInterceptor.class);
    }

    if (log.isDebugEnabled()) {
        clientConfig.register(new LoggingFilter(legacyLogger, true));
    }

    configureHttps(clientConfiguration, clientConfig);

    clientConfig.connectorProvider(new ApacheConnectorProvider());

    Client builtClient = ClientBuilder.newBuilder().withConfig(clientConfig).build();
    builtClient.property(ClientProperties.CONNECT_TIMEOUT, clientConfiguration.getConnectTimeoutMillis());
    builtClient.property(ClientProperties.READ_TIMEOUT, clientConfiguration.getReadTimeoutMillis());
    return builtClient;
}
 
开发者ID:axibase,项目名称:atsd-api-java,代码行数:28,代码来源:HttpClient.java

示例13: configureProxy

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private void configureProxy(
  ClientConfig config,
  String proxyUri,
  String username,
  String password
) {
  config.property(ClientProperties.PROXY_URI, proxyUri);
  if (username != null && !username.isEmpty()) {
    config.property(ClientProperties.PROXY_USERNAME, username);
  }
  if (password != null && !password.isEmpty()) {
    config.property(ClientProperties.PROXY_PASSWORD, password);
  }
  config.connectorProvider(new ApacheConnectorProvider());
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:16,代码来源:OmniturePollingConsumer.java

示例14: getClient

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
/**
	 * REturn REST client with specific authentication
	 *
	 * @param user
	 * @param pwd
	 * @return
	 */
	Client getClient(String user, String pwd) {
		ClientConfig clientConfig = new ClientConfig();
//		clientConfig.connectorProvider(new ApacheConnectorProvider());
		clientConfig.connectorProvider(new JettyConnectorProvider()); // use jetty connector for keep jsession cookies, apache connector works too, grizzly connector, failed
		HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic(user, pwd);
		Client client = ClientBuilder.newClient(clientConfig);
		client.register(feature);
		return client;
	}
 
开发者ID:ocelotds,项目名称:ocelot,代码行数:17,代码来源:AbstractOcelotTest.java

示例15: resetVarnishCache

import org.glassfish.jersey.client.ClientConfig; //导入方法依赖的package包/类
private void resetVarnishCache() {
    ClientConfig cc = new ClientConfig();
    cc.connectorProvider(new ApacheConnectorProvider());
    ClientBuilder
            .newClient(cc)
            .target("http://read.backdrop.perfplat.dev/data/test/test")
            .request()
            .accept(MediaType.APPLICATION_JSON_TYPE)
            .method("PURGE");
}
 
开发者ID:alphagov,项目名称:pp-db-collector-template,代码行数:11,代码来源:EndToEndTest.java


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