Topic: Webdav 连接超时,请各位高手帮帮忙。 |
Print this page |
1.Webdav 连接超时,请各位高手帮帮忙。 | Copy to clipboard |
Posted by: sunstar Posted on: 2005-12-20 16:26 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.read(b); fis.close(); ByteArrayInputStream bais = new ByteArrayInputStream(b); 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); 就会连接超时。 该怎么判断第六行是不是正确的。 |
2.Re:Webdav 连接超时,请各位高手帮帮忙。 [Re: sunstar] | Copy to clipboard |
Posted by: struggle Posted on: 2005-12-21 08:46 httpURL.setUserinfo("esp", "esp");之后的代码全部去掉,运行还报错,就表明有错了~ |
3.Re:Webdav 连接超时,请各位高手帮帮忙。 [Re: struggle] | Copy to clipboard |
Posted by: sunstar Posted on: 2005-12-21 10:30 不好意思,我没有说清楚。 当用户和密码出错时,认证错误,这个httpURL就是无效的。然后就会连接超时,但是现在没有方法判断这个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 |