Topic: Webdav 怎么样处理连接超时?请高手帮忙。

  Print this page

1.Webdav 怎么样处理连接超时?请高手帮忙。 Copy to clipboard
Posted by: sunstar
Posted on: 2005-12-20 16:24

public void upload(String filepath) throws Exception {
WebdavResource resource = null;
File file = null;
try {
HttpURL httpURL = new HttpURL(url);
httpURL.setUserinfo("esp", "esp");
resource = new WebdavResource(httpURL);
file = new File(filepath);
FileInputStream fis = new FileInputStream(file);
byte[] b = new byte[(int) file.length()];
fis.readBeer;
fis.close();
ByteArrayInputStream bais = new ByteArrayInputStreamBeer;
if (false == resource.putMethod(url + file.getName(), bais)) {
throw new Exception("upload failed");
}
resource.commitTransaction();
int statusCode = resource.getStatusCode();
resource.closeSession();
resource.close();
resource = null;
} catch (HttpException he) {
System.out.println(he);
} catch(ConnectException ce) {
System.out.println(ce);
}
finally {
}
}

以上代码中:第6行 httpURL.setUserinfo("esp", "esp");的信息错误
第7行 resource = new WebdavResource(httpURL); 就会连接超时。
该怎么判断第六行是不是正确的。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923