Friday, December 19, 2008

Integrating the BIRT Viewer into OpenReports using Struts Part 1

I wanted to integrate the BIRT 2.3.1 Viewer into OpenReports as a mini-project. The implementation is rather simple, and loose as this was done for a hobby (so nothing professional here) - but hopefully this will help someone out. The final result allows a user in OpenReports to view BIRT reports in the Ajax Based BIRT Web Viewer. I simply utilized the birt tag libraries to deploy the viewer using a simple jsp page.

Since OpenReports uses the Apache Struts 2 Framework, I did a little bit of simple reading on how to configure struts.xml.

Here, I'll give a mini-tutorial on how to get the BIRT Viewer into OpenReports.
The first part of this tutorial will show you how to integrate the viewer into open reports.
I'm using OpenReports 3.1 as of this post and BIRT 2.3.1

1. Download the OpenReports zip file here
2. Download the BIRT 2.3.1 run-time from BIRT here (birt-runtime-2_3_1.zip)
3. Next you'll need to update the BIRT Libraries in OpenReports to the one
which you want to deploy and at the same time we need
to integrate the BIRT Viewer by making some changes to the web.xml descriptor file
(In this tutorial, we'll be using BIRT 2.3.1)

a. We'll first copy the comlete directory that contains the BIRT Viewer located in
birt-runtime-2_3_1\WebViewerExample\webcontent
to
openreports-tomcat\openreports\WebRoot\webcontent

b. Next take the jar files from the BIRT Web Application in
birt-runtime-2_3_1\WebViewerExample\WEB-INF\lib
and carefully copy and replace the old BIRT libraries (2.3.) in
Open reports found in openreports-tomcat\openreports\WebRoot\WEB-INF\lib

b. We need to also port the plugins, tlds, and web.xml to Open Reports.
Copy and integrate the following files from BIRT :

birt-runtime-2_3_1\WebViewerExample\WEB-INF\platform
birt-runtime-2_3_1\WebViewerExample\WEB-INF\tlds
birt-runtime-2_3_1\WebViewerExample\WEB-INF\*.xml
birt-runtime-2_3_1\WebViewerExample\WEB-INF\server-config.wsdd
birt-runtime-2_3_1\WebViewerExample\WEB-INF\viewer.properties

to

openreports-tomcat\openreports\WebRoot\WEB-INF\
For the OpenReport web.xml file, make sure you add the following entries





BIRT_VIEWER_LOCALE
en-US




BIRT_VIEWER_TIMEZONE





BIRT_VIEWER_WORKING_FOLDER





BIRT_VIEWER_DOCUMENT_FOLDER





WORKING_FOLDER_ACCESS_ONLY
false




BIRT_VIEWER_IMAGE_DIR





BIRT_VIEWER_LOG_DIR





BIRT_VIEWER_LOG_LEVEL
WARNING




BIRT_VIEWER_SCRIPTLIB_DIR





BIRT_RESOURCE_PATH





BIRT_VIEWER_MAX_ROWS





BIRT_VIEWER_MAX_CUBE_ROWLEVELS



BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS





BIRT_VIEWER_CUBE_MEMORY_SIZE





BIRT_OVERWRITE_DOCUMENT
true




BIRT_VIEWER_CONFIG_FILE
WEB-INF/viewer.properties




BIRT_VIEWER_PRINT_SERVERSIDE
ON




HTML_ENABLE_AGENTSTYLE_ENGINE
true




ViewerFilter
org.eclipse.birt.report.filter.ViewerFilter


ViewerFilter
ViewerServlet


ViewerFilter
EngineServlet




org.eclipse.birt.report.listener.ViewerServletContextListener




org.eclipse.birt.report.listener.ViewerHttpSessionListener




ViewerServlet
org.eclipse.birt.report.servlet.ViewerServlet




EngineServlet
org.eclipse.birt.report.servlet.BirtEngineServlet



ViewerServlet
/frameset



ViewerServlet
/run



EngineServlet
/preview



EngineServlet
/download



EngineServlet
/parameter



EngineServlet
/document



EngineServlet
/output



EngineServlet
/extract




/birt.tld
/WEB-INF/tlds/birt.tld




http://www.tonbeller.com/wcf

/WEB-INF/wcf/wcf-tags.tld




http://www.tonbeller.com/jpivot

/WEB-INF/jpivot/jpivot-tags.tld





In part 2 of this tutorial we'll integrate the Viewer into the UI.

1 comment:

  1. Hi

    Eclipse Helios 3.6 Birt 2.60 and runtime work well, but i face a trouble with OpenReports. OpenReports 3.2.0 has Birt 2.3.2 embedded. So i try your procedure to update OpenReports but it's failed. I's semm that program BirtReportEngine can do the task.
    the task.run fail without e.


    log.info("Generating BIRT report: " + report.getName());
    task.run();
    log.info("task run ok: "); doesn' display

    If you have a time..

    Many thank's.

    jackson92230@gmail.com

    ReplyDelete