[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.birt] HTTP Get Report PDF from Java
|
- From: mreynolds@xxxxxxxxxxxxxxxx (Mike )
- Date: Thu, 6 Nov 2008 21:33:31 +0000 (UTC)
- Newsgroups: eclipse.birt
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
I am trying to write a small app to save off a pdf report served by a BIRT
Web Viewer deployed to JBOSS. The result of the get seems to be an html
document with a heafty amount of javascript. I think that a second
request may be generated by the JS with the true URL I need. Any ideas?
Here is a snippet of the code and the url I am using
http://localhost:8080/birt/run?__report=reports/med_ordered.rptdesign&__format=pdf&Authorizing
Provider=0&Site=0&StartDate=1900-01-01 00:00:00.000&EndDate=2009-01-01
00:00:00.000&__parameterpage=false
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
URL url = new URL(address);
out = new BufferedOutputStream(
new FileOutputStream(localFileName));
conn = url.openConnection();
in = conn.getInputStream();
byte[] buffer = new byte[1024];
int numRead;
long numWritten = 0;
while ((numRead = in.read(buffer)) != -1) {
out.write(buffer, 0, numRead);
numWritten += numRead;
}
System.out.println(localFileName + "\t" + numWritten);
} catch (Exception exception) {
exception.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException ioe) {
}
}