Over a million developers have joined DZone.

Introducing BIRT iHub F-Type: Integrating into Applications

· Java Zone

Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.

Originally Written by Michael Williams

If you’re familiar with open source BIRT and what the out-of-the-box options for integration are, you know that you had the viewer that could be called by URL, the viewer tag library that allowed you to embed the viewer into a JSP page, or a custom solution you built using the BIRT APIs. With BIRT iHub F-Type, you still have the ability to call visualizations by URL, but you also add the JavaScript API (JSAPI) which allows you to easily embed BIRT content into any page that allows for the use of JavaScript.

In this blog, I’ll show a couple quick examples of calling reports by URL and a couple simple examples of using the JavaScript API to embed BIRT content into a web page.

Calling Reports by URL

When the only integration you care about is to be able to link out to a design from your application or webpage, a simple URL will do. If you’re upgrading your open source application to use BIRT iHub F-Type, you can use the same pattern of URL as you did with the open source viewer, so upgrading is relatively painless.

For example:

If you’re not adapting an open source application your URL would look more like this one:


If you can’t remember the URL pattern, don’t worry. All you need to do is go into the iHub UI, run your design by clicking on it, drop down the menu, and click the “Link to this page” option.


The top option in this window is a link to the design. Copy that and use it wherever you need to.


There are lots of URL parameters available to customize what you get from your URL. One example of this is adding __format=pdf to the above URL:

This will tell the BIRT iHub F-Type to return the PDF copy of the report output.


Using the JSAPI

When your goal is to have a more seamless integration of BIRT content into your application, the JavaScript API (JSAPI) is where you’ll want to start. The JSAPI allows you to quickly and easily embed your BIRT content into any page that allows for the use of JavaScript.

To make it even simpler, you don’t even HAVE to know JavaScript to do the simplest case of embedding using the JSAPI. The iHub will give you a bare minimum block of code for embedding the viewer into you application by simply running your report from the iHub by URL or from the console, then going to the menu and clicking on “Link to this page” like described in the URL section, above. However, this time, we’ll use the second option.


If you copy and paste this into a HTML page, then open it up in the browser, you’ll see the following:


As you can see, the entire viewer is embedded into the page allowing you to step through all 11 pages of the report. There are many settings and features that can be set with the JSAPI to customize your embedded content.

For example, if you bookmarked an item in your report and would like to only embed that single element into your page, you only need to add a single line of script. In the report I used for this blog, I have bookmarked the chart with “myChart”. Inside the myInit function, we simply use the line viewer1.setReportletBookmark(‘myChart’); and we get a single page in the viewer showing just the chart:


Now, what if we don’t want to show the toolbar? To get rid of that, we would just add options.enableToolBar(false); and we’d see just the chart with no toolbar:


You can find more of the things you can do with the JavaScript API by taking a look at the API reference in the documentation.

The report and sample HTML page used in this blog will be posted in the devShare, soon. I will update the blog with a link when it’s available.

Thanks for reading. If you have any questions or comments, please feel free to use the comments section below or visit the BIRT iHub F-Type forum. You can also find more information about the BIRT iHub F-Type in the deployment guide and documentation.


For more blogs in the “Introducing BIRT iHub F-Type” series, see the list below:


Building Identity Management, including authentication and authorization? Try Stormpath! Our REST API and robust Java SDK support can eliminate your security risk and can be implemented in minutes. Sign up, and never build auth again!


Published at DZone with permission of Michael Singer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}