外部系统通过下载接口,可以把系统的文件或附件以二进制流的形式输出到HTTP响应。
名称
downloadService
请求路径:/seeyon/services/downloadService
参数:
| 参数 | 数据类型 | 说明 | 
| token | string | 登录验证后获取的身份令牌。 | 
| fileId | string | 系统中附件ID | 
返回值:文件的二进制流
成功则返回输出流,否则返回提示出错字符
示例:
    StringBuffer parameters = new StringBuffer(); 
     parameters.append("fileId="+"-4951942983085243789");
     parameters.append("&token="+"e821246a-3b2f-4c28-94ab-9410cc19c056");
     URL preUrl = null;
     URLConnection uc = null;
     try {
         preUrl = new URL("http://128.2.3.174/seeyon/services/downloadService");
         String s = parameters.toString();
         uc = preUrl.openConnection();
         uc.setDoOutput(true);
         uc.setUseCaches(false);
         uc.setRequestProperty("Content-Type",
             "application/x-www-form-urlencoded");
         HttpURLConnection hc = (HttpURLConnection) uc;
         hc.setRequestMethod("POST");
         OutputStream os = hc.getOutputStream();
         DataOutputStream dos = new DataOutputStream(os);
         dos.writeBytes(s);
         dos.flush();
         dos.close();
         FileOutputStream file = new FileOutputStream("d:/test.pdf");
         InputStream is = hc.getInputStream();
         int ch;
         while ((ch = is.read()) != -1) {
             file.write(ch);
         }
         if (is != null) is.close();
 
                
          