本文整理了Java中org.apache.commons.httpclient.HttpClient.setTimeout()
方法的一些代码示例,展示了HttpClient.setTimeout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setTimeout()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.HttpClient
类名称:HttpClient
方法名:setTimeout
[英]Sets the socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout.
[中]以毫秒为单位设置套接字超时(SO_timeout),这是等待数据的超时。超时值为零被解释为无限超时。
代码示例来源:origin: tracee/tracee
@Override
@SuppressWarnings("deprecation")
public synchronized void setTimeout(int newTimeoutInMilliseconds) {
delegate.setTimeout(newTimeoutInMilliseconds);
}
代码示例来源:origin: approvals/ApprovalTests.Java
/***********************************************************************/
public InputStream getResponse(HttpClient client, PostMethod post) throws HttpException, IOException
{
// My_System.markerIn();
// My_System.variable(post.getURI().toString());
// My_System.variable("parameters", post.getParameters());
client.setConnectionTimeout(30000);
client.setTimeout(30000);
client.executeMethod(post);
InputStream r = post.getResponseBodyAsStream();
// My_System.markerOut();
return r;
}
/***********************************************************************/
代码示例来源:origin: org.apache.ivy/ivy
private GetMethod doGet(URL url, int timeout) throws IOException {
HttpClient client = getClient();
client.setTimeout(timeout);
GetMethod get = new GetMethod(normalizeToString(url));
get.setDoAuthentication(useAuthentication(url) || useProxyAuthentication());
get.setRequestHeader("Accept-Encoding", "gzip,deflate");
client.executeMethod(get);
return get;
}
代码示例来源:origin: org.apache.ivy/ivy
private HeadMethod doHead(URL url, int timeout) throws IOException {
HttpClient client = getClient();
client.setTimeout(timeout);
HeadMethod head = new HeadMethod(normalizeToString(url));
head.setDoAuthentication(useAuthentication(url) || useProxyAuthentication());
client.executeMethod(head);
return head;
}
内容来源于网络,如有侵权,请联系作者删除!