Integrate BIRT in existing webapp

I was hoping someone knew simply which servlet mappings from the report-engine web.xml file I needed and which jars I would need to include from the lib directory for this barebones BIRT implementation in existing webapp.

I didn't necessarily want to write my own servlet I just wanted to integrate the existing reporting runtime from its own standalone webapp (here under the "runtime" button) into my existing webapp, so that I don't have to distribute 2 webapps to support running BIRT reports. Sorry if that wasn't clearer.

I did work this out though, in the simplest possible fashion, in case anyone has a similar question (using BIRT runtime 3.7.1):

  1. All you need is the following servlet mapping added to your own webapp\web-inf\web.xml file:

    <!-- Engine Servlet -->
    <servlet>
        <servlet-name>EngineServlet</servlet-name>
        <servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>EngineServlet</servlet-name>
        <url-pattern>/output</url-pattern>
    </servlet-mapping>
    
  2. Include all jars from the web-inf\lib directory of the runtime into your own webapp\web-inf\lib directory.

You can then run .rptdesign files using the output BIRT report url from your own webapp, and specifying whatever format you want, e.g.:

http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=pdf
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=html
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=xls
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=doc
http://localhost:8080/myOwnWebapp/output?__report=test.rptdesign&__format=ppt

Tags:

Java

Tomcat

Birt