六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 28|回复: 0

下载文档主附件文件

[复制链接]

升级  14.67%

74

主题

74

主题

74

主题

举人

Rank: 3Rank: 3

积分
244
 楼主| 发表于 2013-2-4 21:47:43 | 显示全部楼层 |阅读模式
如何用后台程序将wtdocument的物理文件和附件下载下来
WTDocument doc = (WTDocument) queryresult.nextElement();
    wt.content.ContentHolder ch = wt.content.ContentHelper.service
      .getContents(doc);
    Vector attachmentList = wt.content.ContentHelper
      .getApplicationData(ch);
    System.out.println("doc is found");
    StreamData sd=(StreamData) StandardFvService.getStreamedObject(ch);
    //sd.retrieveStream();
    for (int j = 0; j < attachmentList.size(); j++) {
     System.out.println("there is some content");
     ApplicationData appdata = (ApplicationData) attachmentList
       .get(j);
     InputStream in = RedirectDownload.getInputStream(appdata,
       ch, true).getStream();
     Vector v=StandardFvService.getFileLocation(appdata);
     
     for(int f=0;f<v.size();f++){
      System.out.println("FileLocation==================="+(String)v.get(f));
     }
     System.out.println("---------------8888888-----------------");
     appdata.getFileName();
     System.out.println("filename======"+appdata.getFileName());
     urlvector.add(in);
     String path="c:\\download\\"+appdata.getFileName();
     downloadfile( in,  path);
 
String absoluteFileName = getTempPath() + fileName; //服务端的物理地址+文件名
 ContentServerHelper.service.writeContentStream(appdata , absoluteFileName);
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表