|
|
|
|
Re: Where can i find the Birt 2.5.2 report engine api documentation? [message #558864 is a reply to message #558667] |
Tue, 14 September 2010 15:50 |
|
Kenny,
The setOutputStream method can use any OutputStream. If you just want
the bytes, create a new ByteArrayOutputStream and use it.
ByteArrayOutputStream baos= new ByteArrayOutputStream();
options.setOutputStream(baos);
mybytearray = baos.getBytes();
Jason
On 9/13/2010 4:34 PM, dash wrote:
> Jason,
>
> Good to hear from you! After digging thru the docs a bit, I can't find
> what I'm looking for. I would like to hear your advice on what I would
> like to implement.
>
> Instead of writing the report to the disk, I would like to get the
> report binary and store it into a byte array in an RunReportResponse
> object, our custom response object, that needs to be populated with
> other data before sending it back to the client.
>
> I've only found an api that does options.setOutputStream(response);
> where response is an HttpServletResponse object. I don't want to stream
> the report back to the client right away.
> I could do the dumb way by writing the report out to a file and reading
> it back to a byte array in the RunReportResponse, but it's an
> unnecessary IO that hammers the performance.
>
> Any suggestion or workaround?
>
> Thanks,
> kenny
>
> // code snippets
> public class RunReportResponse extends ReportResponse
> {
> private byte[] reportData;
> public void setReportData(byte[] reportData)
> {
> this.reportData = reportData;
> }
>
> public byte[] getReportData()
> {
> return reportData;
> }
> }
>
>
> @WebMethod
> public RunReportResponse runReport(RunReportRequest request) {
>
> String reportName = request.getName();
> ...
> if (reportFormat.equalsIgnoreCase(PDF_FORMAT)) {
> PDFRenderOption options = new PDFRenderOption();
>
>
> options.setOutputFileName(REPORTS_PATH + "/" + reportName + "." +
> PDF_FORMAT);
>
> options.setOutputFormat(PDF_FORMAT);
> task.setRenderOption(options);
> }
>
> ...
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03154 seconds