Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: re[birt-report-engine-dev] source folder

ResourceLocators are good, but may be overkill for this.  If you just need a
base location for resources you can:

    final String BIRT_RUNTIME_HOME = new File( "/path/to_birt/home" );
    final String RESOURCE_PATH = new File("/path_to/resource/home" );
    EngineConfig config = new EngineConfig();
    config.setBIRTHome( BIRT_RUNTIME_HOME.getAbsolutePath() );
    config.setResourcePath( RESOURCE_PATH.getAbsolutePath() );

-----Original Message-----
From: birt-report-engine-dev-bounces@xxxxxxxxxxx
[mailto:birt-report-engine-dev-bounces@xxxxxxxxxxx] On Behalf Of sforbes
Sent: Wednesday, July 29, 2009 6:39 PM
To: birt-report-engine-dev@xxxxxxxxxxx
Subject: Re: re[birt-report-engine-dev] source folder


My solution to this was to use an IResourceLocator when opening the report
design, something like this:

	design = engine.openReportDesign(file.getAbsolutePath(),
inputStream, new
IResourceLocator() {
	    public URL findResource(ModuleHandle moduleHandle, String name,
int
type) {
		File f = new File(resourceFiles.getParentFile(), name);
		if ( f.exists() ) {
		    try {
			return f.toURL();
		    } catch (MalformedURLException muex) {
			return null;
		    }
		}
		f = new File(name);
		if ( f.exists() ) {
		    try {
			return f.toURL();
		    } catch (MalformedURLException muex) {
			return null;
		    }
		}
		return null;
	    }
	});

Not sure if the second "new File(name)" is required (or secure), but this
works for me.

Shaun


arnaudcz wrote:
> 
> Does anyone know how to configure the resource folder for the Report
> Engine?
> 

-- 
View this message in context:
http://www.nabble.com/resource-folder-tp24714137p24729956.html
Sent from the Eclipse BIRT - Report Engine - Dev mailing list archive at
Nabble.com.

_______________________________________________
birt-report-engine-dev mailing list
birt-report-engine-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/birt-report-engine-dev




Back to the top