【问题标题】:Programmatically downloading Oracle Business Intelligence report using java使用 java 以编程方式下载 Oracle Business Intelligence 报告
【发布时间】:2011-08-16 13:18:47
【问题描述】:

我需要使用 java 将 OBI 报告下载为 csv。当我进入

http://<my_host>:<my_port>/analytics/saw.dll?Go&Action=Download&path=<my_path>&Format=csv

在浏览器中,出现下载弹出窗口,我可以下载文件。

但是,当我尝试使用 java 下载报告时,它会下载一个 html 内容说 “Oracle BI Presentation Services 不支持您的浏览器。”

这是我使用的一段代码:

URL url = new URL("http://<my_host>:<my_port>/analytics/saw.dll?Go&Action=Download&path=<my_path>&Format=csv");
URLConnection urlc = url.openConnection();
urlc.addRequestProperty("User-Agent", "Mozilla/4.0");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
bos = new BufferedOutputStream(new FileOutputStream("file.csv"), 1024);
bis = new BufferedInputStream(urlc.getInputStream());
byte[] data = new byte[1024];
while ((x = bis.read(data, 0, 1024)) >= 0) {
    bos.write(data, 0, x);
}

那么,如何下载报告?

【问题讨论】:

    标签: java oracle download business-intelligence obiee


    【解决方案1】:

    尝试使用完整的 UA 字符串;解析UA的javascript对它很敏感。

    当您discovered elsewhere 时,您遇到了更多问题,登录页面带有 javascript 重定向到实际页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多