Embedded Images are not appearing in Web logic [message #761928] |
Wed, 07 December 2011 04:50  |
Eclipse User |
|
|
|
We have integrated BIRT in our application and sample code is as below. the images are embedded in reports. Now the problem is that images are appearing in tomcat but not in weblogic (attached screenshot).
// get report name and launch the engine
ByteArrayOutputStream out = new ByteArrayOutputStream();
String path=ApplicationBase.getInstance().getInitHash().getProperty("BIRT_WORKING_FOLDER");
String reportName = request.getParameter("ReportName");
ServletContext sc = request.getSession().getServletContext();
this.birtReportEngine = BirtEngine.getBirtEngine(sc);
// setup image directory
HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setBaseImageURL(request.getContextPath() + "/images");
renderContext.setImageDirectory(sc.getRealPath("/images"));
HashMap<String, HTMLRenderContext> contextMap = new HashMap<String, HTMLRenderContext>();
contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext);
IReportRunnable design;
try {
// Open report design
RequestParameterObject rpo = QueryCrypt.getInstance().decrypt(request);
String name = rpo.getParameter("ReportName");
reportName=name;
design = birtReportEngine.openReportDesign(path+"/birtreports" + "/" + reportName);
System.out.println("::::::path::::::"+path+"/birtreports" + "/" + reportName);
// create task to run and render report
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask(design);
task.setAppContext(contextMap);
// set output options
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setEmbeddable(true);
options.setOutputStream(out);
task.setRenderOption(options);
ReportParameters rpm = new ReportParameters();
task = rpm.setReportParameters(rpo,task);
task.getAppContext().put("OdaJDBCDriverPassInConnection", DBaseBirt.getConnection());
// run report
task.run();
task.close();
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
throw new ServletException(e);
}
return out;
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03719 seconds