[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] BIRT Report - Run time config files

Hi,
We are using BIRT 2.1.2 in our web application and hosting the application from tomcat 5.5.23.


During generation of report, BIRT report engine creates run time configuration files in WEB-INF/platform/configuration folder.

List of run time files created..
\webapps\datacomparisontool\WEB-INF\platform\configuration
07/26/2007  10:04 AM               688 config.ini
07/27/2007  04:17 AM               320 1185509823515.log
07/27/2007  04:17 AM    <DIR>          org.eclipse.core.runtime
07/27/2007  04:17 AM    <DIR>          org.eclipse.update
07/27/2007  08:14 AM    <DIR>          org.eclipse.osgi

As per our organisations security guidelines, application will not write access to the folder WEB-INF and BIRT APIs could not generate the run time files in WEB-INF\platform\configuration.

We are using following code to get the BIRT engine,
=====================================
/**
* This method is used to send the request to BIRT report design which will generate report in HTML format
* @param request a variable of HttpServletRequest type
* @param response a variable of HttpServletResponse type
* @param input a variable of String[] type
* @param reportName a variable of String type * @throws ServletException
*/
private void genReport(HttpServletRequest request,
HttpServletResponse response, String[] input, String reportName)
throws ServletException,Exception {


	ServletContext sc = request.getSession().getServletContext();
	this.birtReportEngine = getBirtEngine(sc);
	HTMLRenderContext renderContext = new HTMLRenderContext();
	renderContext.setBaseImageURL(request.getContextPath() + "/images");
	renderContext.setImageDirectory(sc.getRealPath("/images"));
	HashMap contextMap = new HashMap();
	contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,renderContext);

IReportRunnable design;
try {
design = birtReportEngine.openReportDesign(sc.getRealPath("/reports")+ "\\" + reportName);
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask(design);
task.setAppContext(contextMap);
HTMLRenderOption options = new HTMLRenderOption();
IGetParameterDefinitionTask ptask = birtReportEngine.createGetParameterDefinitionTask(design);
try {
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setOutputStream(response.getOutputStream());
task.setRenderOption(options);
task.run();
task.close();
birtReportEngine.shutdown();
} catch (ClassCastException c) {
c.printStackTrace();
}
} catch (Exception e) {


		e.printStackTrace();
		throw new ServletException(e);
		}
}

/**
* This method is used to initialize the BIRT Report Engine
* @param sc a variable type of ServletContext
* @return a  IReportEngine data type
*/
private IReportEngine getBirtEngine(ServletContext sc) {
	IReportEngine birtEngine = null;
	if (birtEngine == null) {
		EngineConfig config = new EngineConfig();
		config.setEngineHome("");
		IPlatformContext context = new PlatformServletContext(sc);
		config.setPlatformContext(context);

		try {
			Platform.startup(config); -- problematic code
		} catch (BirtException e) {
			e.printStackTrace();
		}

		IReportEngineFactory factory = (IReportEngineFactory) Platform
				.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
		birtEngine = factory.createReportEngine(config);

	}
	return birtEngine;
}

}

=====================================

We are having problem in Platform.startup(config). This API is trying to create the runtime config files in WEB-INF/platform/configuration folder. We need to change the location for creating the run time files. This will solve our problem.

Please help on this.

Thanks a lot.