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


Java HttpClient类代码示例

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


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

示例1: SingularityClient

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
public SingularityClient(String contextPath, HttpClient httpClient, Provider<List<String>> hostsProvider, Optional<SingularityClientCredentials> credentials, boolean ssl, int retryAttempts, Predicate<HttpResponse> retryStrategy) {
  this.httpClient = httpClient;
  this.contextPath = contextPath;

  this.hostsProvider = hostsProvider;
  this.random = new Random();

  this.credentials = credentials;
  this.ssl = ssl;

  this.httpResponseRetryer = RetryerBuilder.<HttpResponse>newBuilder()
      .withStopStrategy(StopStrategies.stopAfterAttempt(retryAttempts))
      .withWaitStrategy(WaitStrategies.exponentialWait())
      .retryIfResult(retryStrategy::test)
      .retryIfException()
      .build();
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:18,代码来源:SingularityClient.java

示例2: SingularityClient

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
public SingularityClient(String contextPath, HttpClient httpClient, Provider<List<String>> hostsProvider, Optional<SingularityClientCredentials> credentials) {
  this.httpClient = httpClient;
  this.contextPath = contextPath;

  this.hostsProvider = hostsProvider;
  this.random = new Random();

  this.credentials = credentials;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:10,代码来源:SingularityClient.java

示例3: configure

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
  ObjectMapper objectMapper = JavaUtils.newObjectMapper();

  HttpClient httpClient = new NingHttpClient(HttpConfig.newBuilder().setObjectMapper(objectMapper).build());
  bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);

  bind(SingularityClient.class).toProvider(SingularityClientProvider.class).in(Scopes.SINGLETON);

  if (hosts != null) {
    bindHosts(binder()).toInstance(hosts);
  }
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:14,代码来源:SingularityClientModule.java

示例4: configure

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
  ObjectMapper objectMapper = JavaUtils.newObjectMapper();
  HttpConfig httpConfig = HttpConfig.newBuilder().setObjectMapper(objectMapper).build();
  HttpClient httpClient = new NingHttpClient(httpConfig);

  bind(ObjectMapper.class).annotatedWith(Names.named(MESOS_CLIENT_OBJECT_MAPPER)).toInstance(objectMapper);
  bind(HttpClient.class).annotatedWith(Names.named(MesosClient.HTTP_CLIENT_NAME)).toInstance(httpClient);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:10,代码来源:SingularityMesosClientModule.java

示例5: configure

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
  ObjectMapper objectMapper = JavaUtils.newObjectMapper();

  HttpClient httpClient = new NingHttpClient(httpConfig.or(HttpConfig.newBuilder().setObjectMapper(objectMapper).build()));
  bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);

  bind(SingularityClient.class).toProvider(SingularityClientProvider.class).in(Scopes.SINGLETON);

  if (hosts != null) {
    bindHosts(binder()).toInstance(hosts);
  }
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:14,代码来源:SingularityClientModule.java

示例6: configure

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
  ObjectMapper objectMapper = JavaUtils.newObjectMapper();
  HttpConfig httpConfig = HttpConfig.newBuilder().setObjectMapper(objectMapper).build();
  HttpClient httpClient = new NingHttpClient(httpConfig);

  bind(ObjectMapper.class).annotatedWith(Names.named(MESOS_CLIENT_OBJECT_MAPPER)).toInstance(objectMapper);
  bind(HttpClient.class).annotatedWith(Names.named(SingularityMesosClient.HTTP_CLIENT_NAME)).toInstance(httpClient);

  bind(MesosClient.class).to(SingularityMesosClient.class).in(Scopes.SINGLETON);
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:12,代码来源:SingularityMesosClientModule.java

示例7: LifecycleHelper

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public LifecycleHelper(BaragonWorkerDatastore workerDatastore,
                       BaragonAuthDatastore authDatastore,
                       BaragonAgentConfiguration configuration,
                       BaragonAgentMetadata baragonAgentMetadata,
                       FilesystemConfigHelper configHelper,
                       BaragonStateDatastore stateDatastore,
                       ServerProvider serverProvider,
                       AtomicReference<BaragonAgentState> agentState,
                       @Named(BaragonAgentServiceModule.BARAGON_AGENT_HTTP_CLIENT) HttpClient httpClient,
                       @Named(BaragonAgentServiceModule.AGENT_SCHEDULED_EXECUTOR) ScheduledExecutorService executorService,
                       @Named(BaragonAgentServiceModule.AGENT_LEADER_LATCH) LeaderLatch leaderLatch,
                       @Named(BaragonAgentServiceModule.AGENT_LOCK) ReentrantLock agentLock,
                       @Named(BaragonAgentServiceModule.AGENT_LOCK_TIMEOUT_MS) long agentLockTimeoutMs) {
  this.workerDatastore = workerDatastore;
  this.authDatastore = authDatastore;
  this.configuration = configuration;
  this.baragonAgentMetadata = baragonAgentMetadata;
  this.configHelper = configHelper;
  this.stateDatastore = stateDatastore;
  this.serverProvider = serverProvider;
  this.agentState = agentState;
  this.httpClient = httpClient;
  this.executorService = executorService;
  this.leaderLatch = leaderLatch;
  this.agentLock = agentLock;
  this.agentLockTimeoutMs = agentLockTimeoutMs;
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:29,代码来源:LifecycleHelper.java

示例8: providesApacheHttpClient

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Provides
@Singleton
@Named(BARAGON_AGENT_HTTP_CLIENT)
public HttpClient providesApacheHttpClient(HttpClientConfiguration config, ObjectMapper objectMapper) {
  HttpConfig.Builder configBuilder = HttpConfig.newBuilder()
    .setRequestTimeoutSeconds(config.getRequestTimeoutInMs() / 1000)
    .setUserAgent(config.getUserAgent())
    .setConnectTimeoutSeconds(config.getConnectionTimeoutInMs() / 1000)
    .setFollowRedirects(true)
    .setMaxRetries(config.getMaxRequestRetry())
    .setObjectMapper(objectMapper);

  return new ApacheHttpClient(configBuilder.build());
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:15,代码来源:BaragonAgentServiceModule.java

示例9: BaragonServiceClient

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
public BaragonServiceClient(String contextPath, HttpClient httpClient, Provider<List<String>> hostsProvider, Provider<Optional<String>> authkeyProvider) {
  this.httpClient = httpClient;
  this.contextPath = contextPath;
  this.hostsProvider = hostsProvider;
  this.authkeyProvider = authkeyProvider;
  this.random = new Random();
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:8,代码来源:BaragonServiceClient.java

示例10: configure

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Override
protected void configure() {
  HttpClient httpClient = new NingHttpClient(HttpConfig.newBuilder()
          .setObjectMapper(buildObjectMapper())
          .build());

  bind(HttpClient.class).annotatedWith(Names.named(HTTP_CLIENT_NAME)).toInstance(httpClient);

  bind(BaragonServiceClient.class).toProvider(BaragonClientProvider.class).in(Scopes.SINGLETON);

  if (hosts != null) {
    bindHosts(binder()).toInstance(hosts);
  }
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:15,代码来源:BaragonClientModule.java

示例11: SingularityClientProvider

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public SingularityClientProvider(@Named(SingularityClientModule.HTTP_CLIENT_NAME) HttpClient httpClient) {
  this.httpClient = httpClient;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:5,代码来源:SingularityClientProvider.java

示例12: MesosClient

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public MesosClient(@Named(HTTP_CLIENT_NAME) HttpClient httpClient) {
  this.httpClient = httpClient;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:5,代码来源:MesosClient.java

示例13: SingularityMesosClient

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public SingularityMesosClient(@Named(HTTP_CLIENT_NAME) HttpClient httpClient) {
  this.httpClient = httpClient;
}
 
开发者ID:HubSpot,项目名称:Singularity,代码行数:5,代码来源:SingularityMesosClient.java

示例14: BaragonClientProvider

import com.hubspot.horizon.HttpClient; //导入依赖的package包/类
@Inject
public BaragonClientProvider(@Named(BaragonClientModule.HTTP_CLIENT_NAME) HttpClient httpClient) {
  this.httpClient = httpClient;
}
 
开发者ID:HubSpot,项目名称:Baragon,代码行数:5,代码来源:BaragonClientProvider.java


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