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


Java JerseyClientBuilder.build方法代碼示例

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


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

示例1: run

import io.dropwizard.client.JerseyClientBuilder; //導入方法依賴的package包/類
@Override
    public void run(ServerConfiguration configuration, Environment environment) throws Exception {
        environment.jersey().disable();

        // Create dataserver client
        final JerseyClientBuilder jerseyClientBuilder = new JerseyClientBuilder(environment).using(configuration.getDataserverClientConfig());
        final DataserverClient dataserverClient = new DataserverClient(jerseyClientBuilder.build("dataserver"), configuration.getDataserverClientConfig());

        // Create session manager
        final SessionManager sessionManager = new SessionManager(dataserverClient);
        environment.lifecycle().manage(sessionManager);

        // Create blind acceptor
        final ClientAcceptor acceptor = new ClientAcceptor(environment.metrics(), configuration.getPort());
        environment.lifecycle().manage(acceptor);

        // TODO: This should really be handled in some kind of configuration?
        acceptor.addPacketHandler(67, new PingHandler());
        acceptor.addPacketHandler(0, new LoginHandler(sessionManager, environment.metrics(), (RSAPrivateKey) configuration.getKeyPair().getPrivate()));
        acceptor.addPacketHandler(29, new LogoutHandler());

        // TODO: Register outgoing message types, these should also be in some config
//        acceptor.addPacketType(131, SystemMessagePacket.class); // TODO: I don't think these IDs are correct
//        acceptor.addPacketType(93, ShowBankScreenPacket.class);
//        acceptor.addPacketType(0, SetPositionPacket.class);
    }
 
開發者ID:reines,項目名稱:rsc,代碼行數:27,代碼來源:Server.java

示例2: createRestClient

import io.dropwizard.client.JerseyClientBuilder; //導入方法依賴的package包/類
private static Client createRestClient(Environment environment, SamConfiguration configuration, String name) {

    final JerseyClientBuilder builder = new JerseyClientBuilder(environment).using(configuration.getJerseyClientConfiguration());
    if (configuration.isLogRequests()) {
      builder.withProvider(new LoggingFeature(HTTP_LOGGER, Level.INFO, Verbosity.PAYLOAD_ANY, LoggingFeature.DEFAULT_MAX_ENTITY_SIZE));
    }
    return builder.build(name);
  }
 
開發者ID:atgse,項目名稱:sam,代碼行數:9,代碼來源:Main.java

示例3: buildJerseyClient

import io.dropwizard.client.JerseyClientBuilder; //導入方法依賴的package包/類
public Client buildJerseyClient(JerseyClientConfiguration configuration, String clientName)
{
    ConnectorProvider localConnectorProvider;
    if ( connectorProvider != null )
    {
        localConnectorProvider = connectorProvider;
    }
    else
    {
        HttpClientBuilder apacheHttpClientBuilder = new HttpClientBuilder(environment).using(configuration);
        CloseableHttpClient closeableHttpClient = apacheHttpClientBuilder.build(clientName);
        localConnectorProvider = new JerseyRetryConnectorProvider(retryComponents, closeableHttpClient, configuration.isChunkedEncodingEnabled());
    }
    JerseyClientBuilder builder = new JerseyClientBuilder(environment)
        .using(configuration)
        .using(localConnectorProvider);
    for ( Class<?> klass : providerClasses )
    {
        builder = builder.withProvider(klass);
    }
    for ( Object provider : providers )
    {
        builder = builder.withProvider(provider);
    }
    Client client = builder
        .build(clientName);

    SoaBundle.getFeatures(environment).putNamed(client, Client.class, clientName);

    return client;
}
 
開發者ID:soabase,項目名稱:soabase,代碼行數:32,代碼來源:ClientBuilder.java


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