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


Java ClientExecutor类代码示例

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


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

示例1: init

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
@Create
public void init() {
	if (this.umaMetadataConfiguration != null) {

		if (applicationConfiguration.isRptConnectionPoolUseConnectionPooling()) {

			// For more information about PoolingHttpClientConnectionManager, please see:
			// http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/index.html?org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html

			log.info("##### Initializing custom ClientExecutor...");
			PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
			connectionManager.setMaxTotal(applicationConfiguration.getRptConnectionPoolMaxTotal());
			connectionManager.setDefaultMaxPerRoute(applicationConfiguration.getRptConnectionPoolDefaultMaxPerRoute());
			connectionManager.setValidateAfterInactivity(applicationConfiguration.getRptConnectionPoolValidateAfterInactivity() * 1000);
			CloseableHttpClient client = HttpClients.custom()
				.setKeepAliveStrategy(connectionKeepAliveStrategy)
				.setConnectionManager(connectionManager)
				.build();
			ClientExecutor clientExecutor = new ApacheHttpClient4Executor(client);
			log.info("##### Initializing custom ClientExecutor DONE");

			this.resourceSetPermissionRegistrationService = UmaClientFactory.instance().createResourceSetPermissionRegistrationService(this.umaMetadataConfiguration, clientExecutor);
			this.rptStatusService = UmaClientFactory.instance().createRptStatusService(this.umaMetadataConfiguration, clientExecutor);

		} else {

			this.resourceSetPermissionRegistrationService = UmaClientFactory.instance().createResourceSetPermissionRegistrationService(this.umaMetadataConfiguration);
			this.rptStatusService = UmaClientFactory.instance().createRptStatusService(this.umaMetadataConfiguration);
		}
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:32,代码来源:UmaProtectionService.java

示例2: getClient

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public static SlackApi getClient() {
	PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
	HttpClient httpClient = HttpClientBuilder.create().setConnectionManager(cm).build();
	//
	ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);
	// new ApacheHttpClient4Engine(httpClient);
	//
	SlackApi slackApi = ProxyFactory.create(SlackApi.class, "https://hooks.slack.com", executor);
	// ResteasyClient client = new ResteasyClientBuilder().httpEngine(new
	// ApacheHttpClient4Engine(httpClient)).build();
	// Client client = ResteasyClientBuilder.newClient();
	// ResteasyWebTarget target =
	// (ResteasyWebTarget)client.target("https://hooks.slack.com");
	// ResteasyWebTarget rtarget = (ResteasyWebTarget) target;

	// SlackApi slackApi = target.proxy(SlackApi.class);
	return slackApi;
}
 
开发者ID:moacyrricardo,项目名称:maven-slack,代码行数:19,代码来源:SlackApiFactory.java

示例3: NubankImportador

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public NubankImportador(){
		ClientConnectionManager cm = new ThreadSafeClientConnManager();
		DefaultHttpClient httpClient = new DefaultHttpClient(cm);

		ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);

		authApi = ProxyFactory.create(NubankAPI.class, "https://prod-auth.nubank.com.br", executor);
		costumersApi = ProxyFactory.create(NubankAPI.class, "https://prod-customers.nubank.com.br", executor);
		accountsApi = ProxyFactory.create(NubankAPI.class, "https://prod-accounts.nubank.com.br", executor);

		ClientResponse<RegistrationResp> resp = authApi.register(RegistrationReq.asNubank());
		if(resp.getStatus() != RegistrationResp.SUCCESS_CODE){
			throw new RuntimeException("Erro registrando api. Status code = "+resp.getStatus());
//			System.out.println(resp.getEntity().getClient_id());
//			System.out.println(resp.getEntity().getClient_secret());
		}
		this.regResp = resp.getEntity();
//		api.token(TokenReq.create(resp.getEntity()));
	}
 
开发者ID:moacyrricardo,项目名称:bank-importer,代码行数:20,代码来源:NubankImportador.java

示例4: getLinkByTitle

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public static Link getLinkByTitle(LinkStrategy strategy, ClientResponse response, String title) {
   if (strategy instanceof LinkHeaderLinkStrategy) {
      return response.getLinkHeader().getLinkByTitle(title);
   } else {
      String headerName = "msg-" + title;
      String href = (String) response.getHeaders().getFirst(headerName);
      if (href == null)
         return null;
      //System.out.println(headerName + ": " + href);
      Link l = new Link(title, null, href, null, null);
      try {
         l.setExecutor((ClientExecutor) executorField.get(response));
      } catch (IllegalAccessException e) {
         throw new RuntimeException(e);
      }
      return l;
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:MessageTestBase.java

示例5: doRestCall

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
/**
 * Get the deployment URL, create the RestEasy Client Proxy Invoker for the given TestMethod and return the result.
 * 
 * @param testMethod
 * @param httpMethods
 * @return
 */
private Response doRestCall(Method testMethod, Set<String> httpMethods)
{
    URI baseUri = getBaseURL();
    ClientExecutor executor = ClientRequest.getDefaultExecutor();
    ResteasyProviderFactory providerFactory = ResteasyProviderFactory.getInstance();
    providerFactory.addBuiltInMessageBodyWriter(MyHeaderDecorator.class);
    EntityExtractorFactory extractorFactory = new DefaultEntityExtractorFactory();

    ArqClientInvoker invoker = new ArqClientInvoker(baseUri, testMethod.getDeclaringClass(), testMethod, providerFactory, executor,
                extractorFactory);
    invoker.getAttributes().putAll(new HashMap<String, Object>());

    ClientInvokerInterceptorFactory.applyDefaultInterceptors(invoker, providerFactory, testMethod.getDeclaringClass(), testMethod);
    invoker.setHttpMethod(httpMethods.iterator().next());

    return invoker.request(new Object[] { null });
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:25,代码来源:RestInvoker.java

示例6: request

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public static Token request(final String tokenUrl, final String umaClientId, final String umaClientSecret, UmaScopeType scopeType,
                            ClientExecutor clientExecutor, String... scopeArray) throws Exception {

    String scope = scopeType.getValue();
    if (scopeArray != null && scopeArray.length > 0) {
        for (String s : scopeArray) {
            scope = scope + " " + s;
        }
    }

    TokenClient tokenClient = new TokenClient(tokenUrl);
    if (clientExecutor != null) {
        tokenClient.setExecutor(clientExecutor);
    }
    TokenResponse response = tokenClient.execClientCredentialsGrant(scope, umaClientId, umaClientSecret);

    if (response.getStatus() == 200) {
        final String patToken = response.getAccessToken();
        final Integer expiresIn = response.getExpiresIn();
        if (Util.allNotBlank(patToken)) {
            return new Token(null, null, patToken, scopeType.getValue(), expiresIn);
        }
    }

    return null;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:27,代码来源:UmaClient.java

示例7: init

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public void init() {
	if (authProvider == null) {
		authProvider = new DeskOAuthProvider(accessKey, accessSecret, token, tokenSecret);
	}

	ClientConnectionManager cm = new ThreadSafeClientConnManager();
	DefaultHttpClient httpClient = new DefaultHttpClient(cm);

	ClientExecutor executor = new ApacheHttpClient4Executor(httpClient);


	userApi = ProxyFactory.create(UserApi.class, endpoint, executor);
	customerApi = ProxyFactory.create(CustomerApi.class, endpoint, executor);
	caseApi = ProxyFactory.create(CaseApi.class, endpoint, executor);
}
 
开发者ID:quintoandar,项目名称:desk.com,代码行数:16,代码来源:DeskApiWrapper.java

示例8: init

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
@PostConstruct
public void init() {
	if (this.umaMetadata != null) {
		if (appConfiguration.isRptConnectionPoolUseConnectionPooling()) {

			// For more information about PoolingHttpClientConnectionManager, please see:
			// http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/index.html?org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html

			log.info("##### Initializing custom ClientExecutor...");
			PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
			connectionManager.setMaxTotal(appConfiguration.getRptConnectionPoolMaxTotal());
			connectionManager.setDefaultMaxPerRoute(appConfiguration.getRptConnectionPoolDefaultMaxPerRoute());
			connectionManager.setValidateAfterInactivity(appConfiguration.getRptConnectionPoolValidateAfterInactivity() * 1000);
			CloseableHttpClient client = HttpClients.custom()
				.setKeepAliveStrategy(connectionKeepAliveStrategy)
				.setConnectionManager(connectionManager)
				.build();
			ClientExecutor clientExecutor = new ApacheHttpClient4Executor(client);
			log.info("##### Initializing custom ClientExecutor DONE");

			this.permissionService = UmaClientFactory.instance().createPermissionService(this.umaMetadata, clientExecutor);
			this.rptStatusService = UmaClientFactory.instance().createRptStatusService(this.umaMetadata, clientExecutor);

		} else {
			this.permissionService = UmaClientFactory.instance().createPermissionService(this.umaMetadata);
			this.rptStatusService = UmaClientFactory.instance().createRptStatusService(this.umaMetadata);
		}
	}
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:30,代码来源:UmaPermissionService.java

示例9: createTrustAllExecutor

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public static ClientExecutor createTrustAllExecutor() {
    try {
        return new ApacheHttpClient4Executor(createHttpClientTrustAll());
    } catch (Exception e) {
        throw new RuntimeException("Failed to create trust_all executor.", e);
    }
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:8,代码来源:Utils.java

示例10: exec

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
@Deprecated
public AuthorizationResponse exec(ClientExecutor clientExecutor) {
    AuthorizationResponse response = null;

    try {
        clientRequest = new ClientRequest(getUrl(), clientExecutor);
        response = exec_();
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }
    // Do not close the connection for this case.

    return response;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:15,代码来源:AuthorizeClient.java

示例11: getRSAPublicKey

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public static RSAPublicKey getRSAPublicKey(String jwkSetUri, String keyId, ClientExecutor clientExecutor) {
    RSAPublicKey publicKey = null;

    JwkClient jwkClient = new JwkClient(jwkSetUri);
    jwkClient.setExecutor(clientExecutor);
    JwkResponse jwkResponse = jwkClient.exec();
    if (jwkResponse != null && jwkResponse.getStatus() == 200) {
        PublicKey pk = jwkResponse.getPublicKey(keyId);
        if (pk instanceof RSAPublicKey) {
            publicKey = (RSAPublicKey) pk;
        }
    }

    return publicKey;
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:16,代码来源:JwkClient.java

示例12: setClientExecutor

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
void setClientExecutor(ClientExecutor executor) {
    _executor = executor;
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:4,代码来源:ClientInvoker.java

示例13: ArqClientInvoker

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
public ArqClientInvoker(URI baseUri, Class<?> declaring, Method method, ResteasyProviderFactory providerFactory, ClientExecutor executor,
            EntityExtractorFactory extractorFactory)
{
    super(baseUri, declaring, method, providerFactory, executor, extractorFactory);
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:6,代码来源:RestInvoker.java

示例14: exec

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
@Deprecated
public OpenIdConnectDiscoveryResponse exec(ClientExecutor executor) {
    this.clientRequest = new ClientRequest(getUrl(), executor);
    return _exec();
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:6,代码来源:OpenIdConnectDiscoveryClient.java

示例15: exec

import org.jboss.resteasy.client.ClientExecutor; //导入依赖的package包/类
@Deprecated
public RegisterResponse exec(ClientExecutor clientExecutor) {
    this.clientRequest = new ClientRequest(getUrl(), clientExecutor);
    return _exec();
}
 
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:6,代码来源:RegisterClient.java


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