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


Java ResteasyClientBuilder.build方法代碼示例

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


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

示例1: DawPurchasesClient

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的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

示例2: createClientWihtoutHostVerification

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的package包/類
/**
 * Returns a new client which disables host verification
 */
public static Client createClientWihtoutHostVerification() {
    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
    clientBuilder.disableTrustManager();
    clientBuilder.hostnameVerifier((s, sslSession) -> true);
    return clientBuilder.build();
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:10,代碼來源:WebClientHelpers.java

示例3: getProxy

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的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

示例4: getProxy

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的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

示例5: createRESTClientProxy

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的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

示例6: getResteasyClient

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的package包/類
private ResteasyClient getResteasyClient(String targetServerUri) throws RestInterfaceFactoryException {
    ResteasyClient client = clients.get(targetServerUri);
    if(client == null) {

        ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
        ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
        clientBuilder.httpEngine(engine);

        client = clientBuilder.build();
        clients.put(targetServerUri, client);
    }

    return client;
}
 
開發者ID:labsai,項目名稱:EDDI,代碼行數:15,代碼來源:RestInterfaceFactory.java

示例7: AbstractRestClient

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的package包/類
/**
    * This constructor is used for the actual construction. The needed REST
    * interface class is provided here to bind the client to the correct
    * implementation.
    * 
    * @param uri
    *            is the target URI.
    * @param restInterface
    *            is the interface class with the specification annotations.
    */
   protected AbstractRestClient(URI uri, Class<GenericRestInterface> restInterface) {
ResteasyClientBuilder resteasyClientBuilder = new ResteasyClientBuilder();
resteasyClientBuilder.register(JacksonJsonProvider.class);
client = resteasyClientBuilder.build();
ResteasyWebTarget webTarget = client.target(uri);
proxy = webTarget.proxy(restInterface);
   }
 
開發者ID:PureSolTechnologies,項目名稱:Purifinity,代碼行數:18,代碼來源:AbstractRestClient.java


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