org.apache.commons.httpclient.HttpConnection.setConnectionTimeout()方法的使用及代码示例

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

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

HttpConnection.setConnectionTimeout介绍

[英]Sets the connection timeout. This is the maximum time that may be spent until a connection is established. The connection will fail after this amount of time.
[中]设置连接超时。这是建立连接之前可能花费的最长时间。在这段时间后,连接将失败。

代码示例

代码示例来源:origin: commons-httpclient/commons-httpclient

/**
 * @deprecated
 */
public void setConnectionTimeout(int timeout) {
  if (hasConnection()) {
    wrappedConnection.setConnectionTimeout(timeout);
  } else {
    // do nothing
  }
}

代码示例来源:origin: org.apache.commons/httpclient

/**
 * @deprecated
 */
public void setConnectionTimeout(int timeout) {
  if (hasConnection()) {
    wrappedConnection.setConnectionTimeout(timeout);
  } else {
    // do nothing
  }
}

代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient

/**
 * @deprecated
 */
public void setConnectionTimeout(int timeout) {
  if (hasConnection()) {
    wrappedConnection.setConnectionTimeout(timeout);
  } else {
    // do nothing
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient

/**
 * @deprecated
 */
public void setConnectionTimeout(int timeout) {
  if (hasConnection()) {
    wrappedConnection.setConnectionTimeout(timeout);
  } else {
    // do nothing
  }
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

/**
 * @deprecated
 */
public void setConnectionTimeout(int timeout) {
  if (hasConnection()) {
    wrappedConnection.setConnectionTimeout(timeout);
  } else {
    // do nothing
  }
}

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

/**
 * @deprecated
 */
public void setConnectionTimeout(int timeout) {
  if (hasConnection()) {
    wrappedConnection.setConnectionTimeout(timeout);
  } else {
    // do nothing
  }
}

代码示例来源:origin: slide/slide-webdavlib

httpState.setCredentials(null, repositoryHost, credentials);
HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
int state = pollMethod.execute(httpState, httpConnection);
if ( state == HttpStatus.SC_MULTI_STATUS ) {

代码示例来源:origin: slide/slide-webdavlib

public boolean unsubscribe(String uri, Subscriber listener, Credentials credentials) {
  UnsubscribeMethod unsubscribeMethod = new UnsubscribeMethod(repositoryDomain+uri);
  synchronized ( subscribers ) {
    for ( Iterator i = subscribers.iterator(); i.hasNext(); ) {
      Subscription subscription = (Subscription)i.next();
      if ( subscription.getSubscriber().equals(listener) ) {
        String id = String.valueOf(subscription.getId());
        unsubscribeMethod.addRequestHeader(UnsubscribeMethod.H_SUBSCRIPTION_ID, id);
        try {
          unsubscribeMethod.setDoAuthentication(true);
          HttpState httpState = new HttpState();
          httpState.setCredentials(null, repositoryHost, credentials);
          HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
          httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
          int state = unsubscribeMethod.execute(httpState, httpConnection);
          if ( state == HttpStatus.SC_OK ) {
            i.remove();
            return true;
          } else {
            logger.log(Level.SEVERE, "Unsubscription failed. State: "+state);
          }
        } catch (IOException e) {
          logger.log(Level.SEVERE, "Unsubscription of listener '"+listener+"' failed!", e);
        }
      }
    }
  }
  logger.log(Level.SEVERE, "Listener not unsubscribed!");
  return false;
}

代码示例来源:origin: slide/slide-webdavlib

httpState.setCredentials(null, repositoryHost, credentials);
HttpConnection httpConnection = new HttpConnection(repositoryHost, repositoryPort, protocol);
httpConnection.setConnectionTimeout(CONNECTION_TIMEOUT);
int state = subscribeMethod.execute(httpState, httpConnection);
if ( state == HttpStatus.SC_OK ) {

相关文章

微信公众号

最新文章

更多

HttpConnection类方法