0

I integrated BIRT 3.7.2 report engine with my web app. Now the problem is, it creates a HTML page (if i am using render format html) in a specific location.

I don't want to save the report html page, instead i want it to show that html directly in my web app(saved in temp and deleted after use). Also it creates a image directory & every time a report with embedded image and/or graph in it, saves the image and/or graph in image directory unnecessary increase space.

Can somebody help me..??

I have followed steps provided in : https://dev.c-ware.de/confluence/display/PUBLIC/Embeding+Birt+into+Application+built+with+Maven

wizavi
  • 104
  • 1
  • 9
  • My question is : How to embed birt report into any jsp page.. ?? Any source any piece of code will be a great help.. – wizavi May 01 '12 at 10:17

1 Answers1

0

I didn't delve into the Birt library to do it and didn't create any classes using their API like it shows in your link, so this may not be the most efficient solution.

This was some months ago and I don't have access to the source now but basically I just added the BirtRuntime to my webapp as a servlet as covered here.

This allowed me to load Birt reports, but I also needed to embed them in existing web pages. I already had a pretty simply proxy servlet in this app which would just read the html content of a url. So I just called this servlet using the url for my BIRT report and I would stick the output where I wanted it on the web page.

Proxy servlet was like this:

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;

public class ProxyServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException  {

        String urlString = request.getParameter("url");
        try {
            URL url = new URL(urlString);
            url.openConnection();
            InputStream in = url.openStream();
            ServletOutputStream out = response.getOutputStream();
            IOUtils.copy(in, out);
        }
        catch (MalformedURLException e) {     
            throw new ServletException(e);
        }
        catch (IOException e) {     
            throw new ServletException(e);
        }
    }
}
Community
  • 1
  • 1
egerardus
  • 11,316
  • 12
  • 80
  • 123