Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Path to image not displayed running OSGI HTTPService
selmer
Hi<br />
<br />
I'm running a servlet that is registered as a OSGI service (HttpService).<br />
The servlet works fine when generating PDF, but when I generate HTML, the generated images of a chart is not displayed although it's been generated to a tempDir:<br />
<br />
The reference in the generated HTML looks like this:<br />
<em class='bbc'><img id="__bookmark_1" src="file:/C:/Documents and Settings/myuserid/Application Data/BIRT/Temp/custom4.jpg" alt="No data" style=" width: 420pt; height: 231pt;display: block;"></img></em><br />
<br />
If I copy the generated html and save it as a html file and run it in a browser the images if found and displayed.<br />
...so, how do I set the correct path when running the server like I do?<br />
<br />
I'm using Birt 2.6.2 on Eclipse 3.6<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>IReportEngine engine =null;
try {
EngineConfig config = new EngineConfig();
String tmpDir = System.getProperty("user.home")+"\\Application Data\\BIRT\\Temp";
IReportEngineFactory factory = (IReportEngineFactory) org.eclipse.birt.core.framework.Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
//Find the template
InputStream designTemplateFile = lookForDesignTemplateFile(designTemplateName);
IReportRunnable design = null;
design = engine.openReportDesign(designTemplateFile);
config.setTempDir(tmpDir);
if(reportType.equalsIgnoreCase("pdf")){
RenderOption options = new RenderOption();
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
options.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF);
options.setOutputFileName(reportFile.getAbsolutePath());
task.setRenderOption(options);
task.run();
task.close();
}
if(reportType.equalsIgnoreCase("html")){
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HTMLRenderOption option = new HTMLRenderOption();
option.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
option.setOutputFileName(reportFile.getAbsolutePath());
option.setImageHandler(new HTMLCompleteImageHandler());
option.setSupportedImageFormats("JPG;GIF;BMP;JPEG");
task.setRenderOption(option);
task.run();
task.close();
}
} finally{
if(engine!=null)
engine.destroy();
}
}</pre>
<br />
/Selmer
Find more posts tagged with
Comments
There are no comments yet