1
我recieving超时问题尝试连接,并使用通过Java代码查询拉力赛的Apache的HttpClient 3.0Apache的HttpClient的处理请求时,客户机(抓I/O异常的超时:连接超时
我做使用XMLHttpRequest的不得到这个问题。
由于主机为https我不能将任何机器,但它是失败的一个上重现此。难道这是一个cacerts的问题?莫不是检查代理的方式?任何日志建议获取更多信息?
Tha NKS!
错误信息是: org.apache.commons.httpclient.HttpmethodDirector executeWithRetry INFO:I/O异常(java.net.ConnectException)处理请求时抓:连接超时:连接。
他们正在运行java jdk 1.6。
protected String doGet(HttpClient httpClient, GetMethod getMethod)
throws IOException
{
httpClient.getState().setCredentials(new AuthScope(this.host, this.port, null), new UsernamePasswordCredentials(this.username, this.password));
httpClient.getParams().setParameter("http.socket.timeout", new Integer(1000000));
getMethod.setDoAuthentication(true);
getMethod.getParams().setParameter("http.socket.timeout", new Integer(1000000));
getMethod.addRequestHeader("X-RallyIntegrationName", this.integrationName);
getMethod.addRequestHeader("X-RallyIntegrationVendor", this.integrationVendor);
getMethod.addRequestHeader("X-RallyIntegrationVersion", this.integrationVersion);
//getMethod.addRequestHeader("X-RallyIntegrationOS", getOSInfo());
//getMethod.addRequestHeader("X-RallyIntegrationPlatform", getProductInfo());
getMethod.addRequestHeader("X-RallyIntegrationLibrary", "Apache Commons HTTP Client 3.0");
try
{
double timeBefore = System.currentTimeMillis()/1000;
int result = httpClient.executeMethod(getMethod);
double timeAfter = System.currentTimeMillis()/1000;
System.out.println("Seconds to query for Workspace: " + (timeAfter - timeBefore));
if (result != 200) {
throw new IOException("Http GET Failed" + getMethod.getStatusLine());
}
String response = getMethod.getResponseBodyAsString();
System.out.println(response);
return response;
}
finally
{
getMethod.releaseConnection();
}
} }