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

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

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

HttpConnection.setSocketTimeout介绍

[英]Sets SO_TIMEOUT value directly on the underlying Socket. This method does not change the default read timeout value set via HttpConnectionParams.
[中]

代码示例

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

public void setSocketTimeout(int timeout) throws SocketException, IllegalStateException {
  if (hasConnection()) {
    wrappedConnection.setSocketTimeout(timeout);
  } else {
    throw new IllegalStateException("Connection has been released");
  }
}

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

/**
 * Applies connection parameters specified for a given method
 * 
 * @param method HTTP method
 * 
 * @throws IOException if an I/O occurs setting connection parameters 
 */
private void applyConnectionParams(final HttpMethod method) throws IOException {
  int timeout = 0;
  // see if a timeout is given for this method
  Object param = method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
  if (param == null) {
    // if not, use the default value
    param = this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
  }
  if (param != null) {
    timeout = ((Integer)param).intValue();
  }
  this.conn.setSocketTimeout(timeout);                    
}

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

conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS);
  readStatusLine(state, conn);
  processStatusLine(state, conn);
  LOG.info("100 (continue) read timeout. Resume sending the request");
} finally {
  conn.setSocketTimeout(readTimeout);

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

public void setSocketTimeout(int timeout) throws SocketException, IllegalStateException {
  if (hasConnection()) {
    wrappedConnection.setSocketTimeout(timeout);
  } else {
    throw new IllegalStateException("Connection has been released");
  }
}

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

public void setSocketTimeout(int timeout) throws SocketException, IllegalStateException {
  if (hasConnection()) {
    wrappedConnection.setSocketTimeout(timeout);
  } else {
    throw new IllegalStateException("Connection has been released");
  }
}

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

public void setSocketTimeout(int timeout) throws SocketException, IllegalStateException {
  if (hasConnection()) {
    wrappedConnection.setSocketTimeout(timeout);
  } else {
    throw new IllegalStateException("Connection has been released");
  }
}

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

public void setSocketTimeout(int timeout) throws SocketException, IllegalStateException {
  if (hasConnection()) {
    wrappedConnection.setSocketTimeout(timeout);
  } else {
    throw new IllegalStateException("Connection has been released");
  }
}

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

public void setSocketTimeout(int timeout) throws SocketException, IllegalStateException {
  if (hasConnection()) {
    wrappedConnection.setSocketTimeout(timeout);
  } else {
    throw new IllegalStateException("Connection has been released");
  }
}

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

/**
 * Applies connection parameters specified for a given method
 * 
 * @param method HTTP method
 * 
 * @throws IOException if an I/O occurs setting connection parameters 
 */
private void applyConnectionParams(final HttpMethod method) throws IOException {
  int timeout = 0;
  // see if a timeout is given for this method
  Object param = method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
  if (param == null) {
    // if not, use the default value
    param = this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
  }
  if (param != null) {
    timeout = ((Integer)param).intValue();
  }
  this.conn.setSocketTimeout(timeout);                    
}

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

/**
 * Applies connection parameters specified for a given method
 * 
 * @param method HTTP method
 * 
 * @throws IOException if an I/O occurs setting connection parameters 
 */
private void applyConnectionParams(final HttpMethod method) throws IOException {
  int timeout = 0;
  // see if a timeout is given for this method
  Object param = method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
  if (param == null) {
    // if not, use the default value
    param = this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
  }
  if (param != null) {
    timeout = ((Integer)param).intValue();
  }
  this.conn.setSocketTimeout(timeout);                    
}

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

/**
 * Applies connection parameters specified for a given method
 * 
 * @param method HTTP method
 * 
 * @throws IOException if an I/O occurs setting connection parameters 
 */
private void applyConnectionParams(final HttpMethod method) throws IOException {
  int timeout = 0;
  // see if a timeout is given for this method
  Object param = method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
  if (param == null) {
    // if not, use the default value
    param = this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
  }
  if (param != null) {
    timeout = ((Integer)param).intValue();
  }
  this.conn.setSocketTimeout(timeout);                    
}

代码示例来源:origin: org.zaproxy/zap

/**
 * Applies connection parameters specified for a given method
 * 
 * @param method HTTP method
 * 
 * @throws IOException if an I/O occurs setting connection parameters 
 */
private void applyConnectionParams(final HttpMethod method) throws IOException {
  int timeout = 0;
  // see if a timeout is given for this method
  Object param = method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
  if (param == null) {
    // if not, use the default value
    param = this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
  }
  if (param != null) {
    timeout = ((Integer)param).intValue();
  }
  this.conn.setSocketTimeout(timeout);                    
}

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

/**
 * Applies connection parameters specified for a given method
 * 
 * @param method HTTP method
 * 
 * @throws IOException if an I/O occurs setting connection parameters 
 */
private void applyConnectionParams(final HttpMethod method) throws IOException {
  int timeout = 0;
  // see if a timeout is given for this method
  Object param = method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
  if (param == null) {
    // if not, use the default value
    param = this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
  }
  if (param != null) {
    timeout = ((Integer)param).intValue();
  }
  this.conn.setSocketTimeout(timeout);                    
}

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

conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS);
  readStatusLine(state, conn);
  processStatusLine(state, conn);
  LOG.info("100 (continue) read timeout. Resume sending the request");
} finally {
  conn.setSocketTimeout(readTimeout);

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

conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS);
  readStatusLine(state, conn);
  processStatusLine(state, conn);
  LOG.info("100 (continue) read timeout. Resume sending the request");
} finally {
  conn.setSocketTimeout(readTimeout);

代码示例来源:origin: org.zaproxy/zap

conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS);
  readStatusLine(state, conn);
  processStatusLine(state, conn);
  LOG.info("100 (continue) read timeout. Resume sending the request");
} finally {
  conn.setSocketTimeout(readTimeout);

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

conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS);
  readStatusLine(state, conn);
  processStatusLine(state, conn);
  LOG.info("100 (continue) read timeout. Resume sending the request");
} finally {
  conn.setSocketTimeout(readTimeout);

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

conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS);
  readStatusLine(state, conn);
  processStatusLine(state, conn);
  LOG.info("100 (continue) read timeout. Resume sending the request");
} finally {
  conn.setSocketTimeout(readTimeout);

相关文章

微信公众号

最新文章

更多

HttpConnection类方法