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


Java ResteasyWebTarget.proxy方法代碼示例

本文整理匯總了Java中org.jboss.resteasy.client.jaxrs.ResteasyWebTarget.proxy方法的典型用法代碼示例。如果您正苦於以下問題:Java ResteasyWebTarget.proxy方法的具體用法?Java ResteasyWebTarget.proxy怎麽用?Java ResteasyWebTarget.proxy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jboss.resteasy.client.jaxrs.ResteasyWebTarget的用法示例。


在下文中一共展示了ResteasyWebTarget.proxy方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testAddSkill

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
@Test
public void testAddSkill(@ArquillianResource URL baseUrl) throws IOException {
    ResteasyClient client = new ResteasyClientBuilder().build();
    ResteasyWebTarget target = client.target(baseUrl.toExternalForm() + "rest");
    SkillRestService skillRestService = target.proxy(SkillRestService.class);
    int tenantId = generateDatabase(baseUrl);
    
    skillRestService.addSkill(tenantId, new Skill(tenantId, "D"));
    
    List<Skill> skills = skillRestService.getSkillList(tenantId);
    
    assertEquals("List size don't match", SKILLS.length + 1, skills.size());
    
    for (String name : SKILLS) {
        assertContainsSkill(skills, tenantId, name);
    }
    assertContainsSkill(skills, tenantId, "D");
}
 
開發者ID:kiegroup,項目名稱:optashift-employee-rostering,代碼行數:19,代碼來源:SkillRestServiceTest.java

示例2: testGetSkill

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
@Test
public void testGetSkill(@ArquillianResource URL baseUrl) throws IOException {
    ResteasyClient client = new ResteasyClientBuilder().build();
    ResteasyWebTarget target = client.target(baseUrl.toExternalForm() + "rest");
    SkillRestService skillRestService = target.proxy(SkillRestService.class);
    int tenantId = generateDatabase(baseUrl);
    
    List<Skill> skills = skillRestService.getSkillList(tenantId);
    
    Skill skill1 = getSkill(skills, "A").get();
    Skill skill2 = skillRestService.getSkill(tenantId, skill1.getId());
    
    assertNotNull("REST method did not return a result", skill2);
    assertEquals(skill1.getId(), skill2.getId());
    assertEquals(skill1.getName(), skill2.getName());
    assertEquals(skill1.getTenantId(), skill2.getTenantId());
    
    assertEquals("List size don't match", SKILLS.length, skills.size());
    
    for (String name : SKILLS) {
        assertContainsSkill(skills, tenantId, name);
    }
}
 
開發者ID:kiegroup,項目名稱:optashift-employee-rostering,代碼行數:24,代碼來源:SkillRestServiceTest.java

示例3: sendInquiry

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
public String sendInquiry(RentalOrder entityOrder, String processInstanceID) {
	// parse RentalOrder object to Order object (which represents the agreed upon JSON format)
	System.out.println("PARSING SENDING OBJECT");
	User user = parseUser(entityOrder);
	Collection<org.camunda.bpm.bvis.rest.send.dto.Car> cars = parseCars(entityOrder);
	org.camunda.bpm.bvis.rest.send.dto.Insurance insurance = parseInsurance(entityOrder);
	Order order = parseOrder(cars, insurance, user, entityOrder);
	ContractDetailsDTO contractDetails = new ContractDetailsDTO();
	contractDetails.setOrder(order);
	contractDetails.setProcessinstance_id_bvis(processInstanceID);
	System.out.println("SENDING OBJECT SUCCESSFULLY PARSED");

	System.out.println("SENDING PARSED OBJECT ORDER ID: " + contractDetails.getOrder().getOrder_id());
	RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
	ResteasyWebTarget target = new ResteasyClientBuilder().build().target(BASE_URI);
	SendInquiryClient senderClient = target.proxy(SendInquiryClient.class);
	String result = senderClient.sendInquiry(contractDetails);
	return result;
}
 
開發者ID:derursm,項目名稱:bvis,代碼行數:20,代碼來源:SendInquiry.java

示例4: sendContractConfirmation

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
public String sendContractConfirmation(RentalOrder entityOrder, String processInstanceIDBVIS, 
		String processInstanceIDCapitol, int contractStatus) {
	ContractConfirmationDTO contractConfirmation = new ContractConfirmationDTO();
	contractConfirmation.setProcessinstance_id_capitol(processInstanceIDBVIS);
	contractConfirmation.setProcessinstance_id_capitol(processInstanceIDCapitol);
	ContractConfirmationOrder order = new ContractConfirmationOrder();
	order.setOrder_id(entityOrder.getOrderID());
	order.setRequest_date(entityOrder.getRequestDate());
	order.setContract_status(contractStatus);
	contractConfirmation.setOrder(order);
	
	RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
	ResteasyWebTarget target = new ResteasyClientBuilder().build().target(BASE_URI);
	SendContractConfirmationClient senderClient = target.proxy(SendContractConfirmationClient.class);
	String result = senderClient.sendClaim(contractConfirmation);
	return result;
}
 
開發者ID:derursm,項目名稱:bvis,代碼行數:18,代碼來源:SendContractConfirmation.java

示例5: DawPurchasesClient

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
public DawPurchasesClient(boolean useHttps, String hostname, int port) {
    checkNotNull(hostname, "hostname");
    checkArgument(port > 0, "Invalid port %s", port);
    String apiHostUrl = String.format("%s://%s:%d", useHttps ? "https" : "http", hostname, port);

    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
    clientBuilder.establishConnectionTimeout(GLOBAL_TIMEOUT, TimeUnit.MILLISECONDS);
    clientBuilder.socketTimeout(GLOBAL_TIMEOUT, TimeUnit.MILLISECONDS);
    clientBuilder.maxPooledPerRoute(GLOBAL_MAX_CONNS);
    clientBuilder.connectionPoolSize(GLOBAL_MAX_CONNS);
    clientBuilder.connectionTTL(CONNECTION_TTL, TimeUnit.MILLISECONDS);
    clientBuilder.connectionCheckoutTimeout(GET_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);

    jaxRsClient = clientBuilder.build();
    ResteasyWebTarget target = jaxRsClient.target(apiHostUrl);

    // TODO: potential improvements here:
    //   - Avoid "useHttps" boolean parameter - enum instead

    apiClientProxy = target.proxy(ApiSpec.class);
}
 
開發者ID:MiguelGL,項目名稱:popular-purchases-demo,代碼行數:22,代碼來源:DawPurchasesClient.java

示例6: getProxy

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
private <T> T getProxy(Class<T> proxyType, Object provider) {
  ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
  clientBuilder.register(provider);

  ResteasyClient client = clientBuilder.build();
  WebTarget target = client.target(apmUri);
  ResteasyWebTarget rtarget = (ResteasyWebTarget) target;

  return rtarget.proxy(proxyType);
}
 
開發者ID:chonton,項目名稱:apm-client,代碼行數:11,代碼來源:Writer.java

示例7: getProxy

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
private <T> T getProxy(Class<T> proxyType) {
  ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
  clientBuilder.register(new MsgPackProvider());

  ResteasyClient client = clientBuilder.build();
  WebTarget target = client.target("http://localhost:7755");
  ResteasyWebTarget rtarget = (ResteasyWebTarget) target;

  return rtarget.proxy(proxyType);
}
 
開發者ID:chonton,項目名稱:apm-client,代碼行數:11,代碼來源:ApmApiTest.java

示例8: buildProxy

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
@Override
protected Object buildProxy(ClientTransportConfig transportConfig) throws Exception{
    ResteasyClient client = new ResteasyClientBuilder()
            .establishConnectionTimeout(transportConfig.getConnectionTimeout(), TimeUnit.MILLISECONDS)
            .socketTimeout(transportConfig.getInvokeTimeout(), TimeUnit.MILLISECONDS)
      .connectionPoolSize(clientTransportConfig.getClientBusinessPoolSize())// 連接池?
            .build();

    Provider provider = transportConfig.getProvider();
    String url = "http://" + provider.getIp() + ":" + provider.getPort()
            + "/" + StringUtils.trimToEmpty(provider.getPath());
    ResteasyWebTarget target = client.target(url);
    return target.proxy(ClassLoaderUtils.forName(provider.getInterfaceId()));
}
 
開發者ID:tiglabs,項目名稱:jsf-sdk,代碼行數:15,代碼來源:HttpRestClientTransport.java

示例9: testGetSkillList

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
@Test
public void testGetSkillList(@ArquillianResource URL baseUrl) throws IOException {
    ResteasyClient client = new ResteasyClientBuilder().build();
    ResteasyWebTarget target = client.target(baseUrl.toExternalForm() + "rest");
    SkillRestService skillRestService = target.proxy(SkillRestService.class);
    
    int tenantId = generateDatabase(baseUrl);
    List<Skill> skills = skillRestService.getSkillList(tenantId);
    
    assertEquals("List size don't match", SKILLS.length, skills.size());
    
    for (String name : SKILLS) {
        assertContainsSkill(skills, tenantId, name);
    }
}
 
開發者ID:kiegroup,項目名稱:optashift-employee-rostering,代碼行數:16,代碼來源:SkillRestServiceTest.java

示例10: generateDatabase

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
private static int generateDatabase(URL baseUrl) { 
    ResteasyClient client = new ResteasyClientBuilder().build();
    ResteasyWebTarget target = client.target(baseUrl.toExternalForm() + "rest");
    SkillRestService skillRestService = target.proxy(SkillRestService.class);
    
    for (String name : SKILLS) {
        skillRestService.addSkill(numOfTestRun, new Skill(numOfTestRun,name));
    }
    
    numOfTestRun++;
    return numOfTestRun - 1;
}
 
開發者ID:kiegroup,項目名稱:optashift-employee-rostering,代碼行數:13,代碼來源:SkillRestServiceTest.java

示例11: getClient

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
private CmdClient getClient() {
  ResteasyClient client = new ResteasyClientBuilder().build();
  ResteasyWebTarget target;

  String commandRootUrl = super.getCommandRootUrl();
  if (commandRootUrl == null || commandRootUrl.isEmpty()) {
    target = client.target(url);
  } else {
    target = client.target(commandRootUrl + super.getPath());
  }

  return target.proxy(CmdClient.class);
}
 
開發者ID:edgexfoundry,項目名稱:core-command-client,代碼行數:14,代碼來源:CmdClientImpl.java

示例12: sendClaim

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
public String sendClaim(org.camunda.bpm.bvis.entities.Claim claim, String processInstanceID) {
	ClaimDetailsDTO claimDetails = new ClaimDetailsDTO();
	claimDetails.setProcessinstance_id_bvis(processInstanceID);
	claimDetails.setRequest_date(Calendar.getInstance());
	Collection<Involved_party> involvedParties = this.parseInvolvedParties(claim);
	claimDetails.setClaim(this.parseClaim(claim, involvedParties));
	RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
	ResteasyWebTarget target = new ResteasyClientBuilder().build().target(BASE_URI);
	SendClaimClient senderClient = target.proxy(SendClaimClient.class);
	System.out.println("SENDING CLAIM FOR ORDER ID: " + claimDetails.getClaim().getOrder_id());
	String result = senderClient.sendClaim(claimDetails);
	return result;
}
 
開發者ID:derursm,項目名稱:bvis,代碼行數:14,代碼來源:SendClaim.java

示例13: sendClaimReview

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
public String sendClaimReview(ClaimReview entityReview,
		String processInstanceID) {
	ClaimReviewDTO review = new ClaimReviewDTO();
	review.setDecision(this.parseClaimReviewDecision(entityReview));
	review.setProcessinstance_id_bvis(processInstanceID);
	review.setProcessinstance_id_capitol(entityReview.getProcessIDCapitol());
	ResteasyWebTarget target = new ResteasyClientBuilder().build().target(BASE_URI);
	SendClaimReviewClient senderClient = target.proxy(SendClaimReviewClient.class);
	String result = senderClient.sendClaimReview(review);
	return result;
}
 
開發者ID:derursm,項目名稱:bvis,代碼行數:12,代碼來源:SendClaimReview.java

示例14: main

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
public static void main(String[] args) {
    ResteasyClient client = new ResteasyClientBuilder().build();
    ResteasyWebTarget target = client.target("http://localhost:8089/rest/hello/v1");

    HelloService helloService = target.proxy(HelloService.class);


    int num = 0;
    int loopCount = 100000;
    long start = System.currentTimeMillis();
    for (int i = 0; i < loopCount; i++) {
        try {
            long s = System.currentTimeMillis();
            String result = helloService.hello("World");
            // int temp = helloService.parseIntStr("test");
            long use = System.currentTimeMillis() - s;
            System.out.println(num + " = " + use + " ms " + result);
        } catch (Exception e) {
            System.err.println("++++++" + e.toString());
        }

        num++;
    }

    long time = System.currentTimeMillis() - start;
    System.out.println("loop: " + loopCount);
    System.out.println("time: " + time + "ms");
    System.out.println("rt: " + (double) time / loopCount);
    System.out.println("tps: " + (double) loopCount / ((double) time / 1000));

    System.exit(0);
}
 
開發者ID:netboynb,項目名稱:coco,代碼行數:33,代碼來源:ResteasyProxyClient.java

示例15: createRESTClientProxy

import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; //導入方法依賴的package包/類
@Override
protected <T> T createRESTClientProxy(String apiUrl, Class<T> proxy) {
    URI i = null;
    try {
        i = new URI(apiUrl);
    } catch (URISyntaxException ex) {
        throw new RuntimeException(ex);
    }
    ResteasyClientBuilder builder = new ResteasyClientBuilder();
    builder.connectionCheckoutTimeout(CONNECTION_SETUP_TO, TimeUnit.SECONDS);
    builder.socketTimeout(CONNECTION_SETUP_TO, TimeUnit.SECONDS);
    builder.httpEngine(new URLConnectionEngine());
    
    ResteasyProviderFactory.getInstance().register(builder);

    ResteasyClient client = builder.build();
    client.register(new ClientRequestFilter() {
        @Override
        public void filter(ClientRequestContext requestContext) throws IOException {
            requestContext.getHeaders().add("User-Agent", getImplementationName() + "=" + getVersion());
        }
    });
    ObjectMapper mapper = new ObjectMapper();
    JacksonJaxbJsonProvider jaxbProvider
            = new JacksonJaxbJsonProvider(mapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());

    mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    builder.register(jaxbProvider);
    builder.register(proxy);

    ResteasyWebTarget resteasyWebTarget = client.target(i);
    return resteasyWebTarget.proxy(proxy);
}
 
開發者ID:gopaycommunity,項目名稱:gopay-java-api,代碼行數:35,代碼來源:ResteasyGPConnector.java


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