org.eclipse.jetty.client.HttpClient.setConnectorType()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.eclipse.jetty.client.HttpClient.setConnectorType()方法的一些代码示例,展示了HttpClient.setConnectorType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setConnectorType()方法的具体详情如下:
包路径:org.eclipse.jetty.client.HttpClient
类名称:HttpClient
方法名:setConnectorType

HttpClient.setConnectorType介绍

暂无

代码示例

代码示例来源:origin: org.scalatra.socketio-java/socketio-core

@Override
public void connect() {
  if (client == null) {
    client = new HttpClient();
    client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
    try {
      client.start();
    } catch (Exception e) {
      client = null;
      listener.onDisconnect(DisconnectReason.ERROR, "Failed to initialize");
    }
  }
  
}

代码示例来源:origin: tadglines/Socket.IO-Java

@Override
public void connect() {
  if (client == null) {
    client = new HttpClient();
    client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
    try {
      client.start();
    } catch (Exception e) {
      client = null;
      listener.onDisconnect(DisconnectReason.ERROR, "Failed to initialize");
    }
  }
  
}

代码示例来源:origin: org.scalatra.socketio-java/socketio-core

@Override
public void connect() {
  if (state != ConnectionState.CLOSED) {
    throw new IllegalStateException("Not CLOSED!");
  }
  state = ConnectionState.CONNECTING;
  client = new HttpClient();
  client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
  client.setIdleTimeout(30*1000); //30 seconds
  try {
    client.start();
  } catch (Exception e) {
    client = null;
    _disconnect(DisconnectReason.CONNECT_FAILED, "Failed to initialize");
    return;
  }
  doGet();
}

代码示例来源:origin: org.openhab.binding/org.openhab.binding.fritzaha

sid = null;
asyncclient = new HttpClient(new SslContextFactory(true));
asyncclient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
asyncclient.setMaxConnectionsPerAddress(asyncmaxconns);
asyncclient.setTimeout(asynctimeout);

代码示例来源:origin: tadglines/Socket.IO-Java

@Override
public void connect() {
  if (state != ConnectionState.CLOSED) {
    throw new IllegalStateException("Not CLOSED!");
  }
  state = ConnectionState.CONNECTING;
  client = new HttpClient();
  client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
  client.setIdleTimeout(30*1000); //30 seconds
  try {
    client.start();
  } catch (Exception e) {
    client = null;
    _disconnect(DisconnectReason.CONNECT_FAILED, "Failed to initialize");
    return;
  }
  doGet();
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);

代码示例来源:origin: org.sonatype.nexus/nexus-indexer

httpClient.setConnectorType( HttpClient.CONNECTOR_SELECT_CHANNEL );
if ( maxConnections > 0 )

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

private void initializeClient() throws Exception
  _client.setConnectorType(_connectorType);

代码示例来源:origin: org.apache.servicemix/servicemix-http

public org.eclipse.jetty.client.HttpClient createNewJettyClient() throws Exception {
  org.eclipse.jetty.client.HttpClient tempClient = new org.eclipse.jetty.client.HttpClient();
  QueuedThreadPool btp = new QueuedThreadPool();
  btp.setMaxThreads(getConfiguration().getJettyClientThreadPoolSize());
  tempClient.setThreadPool(btp);
  tempClient.setConnectorType(org.eclipse.jetty.client.HttpClient.CONNECTOR_SELECT_CHANNEL);
  tempClient.setTimeout(getConfiguration().getProviderExpirationTime());
  tempClient.setConnectTimeout(getConfiguration().getClientConnectTimeout());
  tempClient.setMaxConnectionsPerAddress(getConfiguration().getMaxConnectionsPerAddress());
  tempClient.start();
  return tempClient;
}

代码示例来源:origin: net.anthavio/hatatitla

public HttpClient buildHttpClient() {
  HttpClient client = new HttpClient();
  //client.setConnectBlocking(false);
  client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
  client.setConnectTimeout(getConnectTimeoutMillis());
  client.setTimeout(getReadTimeoutMillis());
  client.setMaxConnectionsPerAddress(getPoolMaximumSize());
  client.setThreadPool(new QueuedThreadPool(getPoolMaximumSize()));
  //client.setIdleTimeout(config.get???);
  if (getFollowRedirects()) {
    client.setMaxRedirects(10);
  }
  if (getAuthentication() != null) {
    Realm realm = new SimpleRealm("whatever", getAuthentication().getUsername(), getAuthentication().getPassword());
    client.setRealmResolver(new SimpleRealmResolver(realm));
  }
  return client;
}

代码示例来源:origin: org.apache.servicemix/servicemix-http

jettyClient = new SSLManagedHttpClient();
jettyClient.setThreadPool(new QueuedThreadPool(getConfiguration().getJettyClientThreadPoolSize()));
jettyClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
if (proxyHost != null) {
  jettyClient.setProxy(new Address(proxyHost, proxyPort));

相关文章

HttpClient类方法