Report Object Model API SessionHandle.openDesign [message #139167] |
Fri, 03 March 2006 18:02 |
Eclipse User |
|
|
|
Originally posted by: ericamjackson.hotmail.com
I am attempting to use BIRT 2.0 in a Web Application and have run into
some problems while trying to modify the design of one of my reports. Our
application has a complicated set of report parameters the user can choose
from, so we decided to build our own parameters pages and then just modify
the SQL of the BIRT report to add in the parameters the user picked.
I would just use the name of the file for the report to open the report
design, but I was having issues figuring out the path to the file because
I am running from a web server. Instead of the file name, I had to use
the class loader to get the report input stream. So, I am trying to use
the openDesign method with a null file name and an input stream like this:
InputStream reportStream =
Thread.currentThread().getContextClassLoader().getResourceAs Stream(reportFileName);
SessionHandle session = DesignEngine.newSession(null);
ReportDesignHandle design = session.openDesign((String)null, reportStream);
According to the API, if you pass in a null filename string to this
openDesign method, "the design will be treated as a new design, and will
be saved to a different file." When I run the code above, I get a
NullPointerException:
java.lang.NullPointerException
org.eclipse.birt.report.model.api.util.URIUtil.convertFileNa meToURLString(URIUtil.java:184)
org.eclipse.birt.report.model.api.util.URIUtil.getDirectory( URIUtil.java:229)
org.eclipse.birt.report.model.parser.DesignReader.read(Desig nReader.java:84)
org.eclipse.birt.report.model.core.DesignSession.openDesign( DesignSession.java:205)
org.eclipse.birt.report.model.api.SessionHandle.openDesign(S essionHandle.java:156)
......
Am I using the API incorrectly? I can tell by debugging my code that the
report stream is not null and seems to contain the data for the report.
In fact, I use the same report stream code in another area of my
application to create an IReportRunnable object.
Any help would be appreciated. If anyone has a good way to figure out the
path for a file deployed to a web server, I would gladly take suggestions
on that as well. That way I wouldn't have to deal with input streams at
all.
Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.02888 seconds