Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to locate the connection profile store when BIRT running in a web app?
How to locate the connection profile store when BIRT running in a web app? [message #904400] Tue, 28 August 2012 11:27 Go to next message
Paul Ramsden is currently offline Paul RamsdenFriend
Messages: 84
Registered: February 2011
Location: BW, Germany
Member
BIRT 3.7.2
WebSphere 7

I recently deployed BIRT into an existing web app. I copied all the jars etc and wrote a servlet which handles report requests. Note I am *not* using the BirtViewer.

All reports have a common library which makes use of a connection profile store. This store contains all connection profiles for test and production environments. The 2 data sources I have defined use scripts to find the profile store file and to determine the profile name (test/prod).

Store file name:
function getProfilePath() {
	if(reportContext.getHttpServletRequest() != null) {
		var rp = reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath("connectionStore.xml");
		if( rp != null ){
			return rp;
		}
	}

	return "connectionStore.xml";
}


Profile name (for DB/2):
function getDb2Profile(runtime) {
	var p = params["__runtime"].value;
	p = p.toLowerCase();
	
	if(p== 'prod') {
		return 'MVSDB2P';
	} else {
		return 'MVSDB2T';
	}
}


The problem I have is that the file is not found at runtime. The value of 'reportContext.getHttpServletRequest()' is null and the path is then incorrect.

My (temporary) solution is to hard-code the return value in the getProfilePath() function on each platform. This proves everything else is working but I need a better solution.

Why is the getHttpServletRequest value empty? Could I set a path in the servlet init() function which could be used later?

[Updated on: Tue, 28 August 2012 11:30]

Report message to a moderator

Re: How to locate the connection profile store when BIRT running in a web app? [message #904626 is a reply to message #904400] Tue, 28 August 2012 21:04 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Paul

If you are writting your own servlet you have to add the request to the
appcontext like:


task.getAppContext().put(EngineConstants.APPCONTEXT_BIRT_VIEWER_HTTPSERVET_REQUEST,
request );

Jason


On 8/28/2012 7:27 AM, Paul Ramsden wrote:
> BIRT 3.7.2
> WebSphere 7
>
> I recently deployed BIRT into an existing web app. I copied all the jars
> etc and wrote a servlet which handles report requests. Note I am *not*
> using the BirtViewer.
>
> All reports have a common library which makes use of a connection
> profile store. This store contains all connection profiles for test and
> production environments. The 2 data sources I have defined use scripts
> to find the profile store file and to determine the profile name
> (test/prod).
>
> Store file name:
>
> function getProfilePath() {
> if(reportContext.getHttpServletRequest() != null) {
> var rp =
> reportContext.getHttpServletRequest().getSession().getServletContext().getRealPath("connectionStore.xml");
>
> if( rp != null ){
> return rp;
> }
> }
>
> return "connectionStore.xml";
> }
>
>
> Profile name (for DB/2):
>
> function getDb2Profile(runtime) {
> var p = params["__runtime"].value;
> p = p.toLowerCase();
>
> if(p== 'prod') {
> return 'MVSDB2P';
> } else {
> return 'MVSDB2T';
> }
> }
>
>
> The problem I have is that the file is not found at runtime. The value
> of 'reportContext.getHttpServletRequest()' is null and the path is then
> incorrect.
>
> Why is the getHttpServletRequest value empty? Could I set a path in the
> servlet init() function which could be used later?
Re: How to locate the connection profile store when BIRT running in a web app? [message #904814 is a reply to message #904626] Wed, 29 August 2012 07:47 Go to previous message
Paul Ramsden is currently offline Paul RamsdenFriend
Messages: 84
Registered: February 2011
Location: BW, Germany
Member
Thanks! Works fine.
Previous Topic:including a Birt report to a JSF application (howto?)
Next Topic:[CentOS/Tomcat] Birt Viewer JDBC configured in XML
Goto Forum:
  


Current Time: Sun Oct 17 23:17:33 GMT 2021

Powered by FUDForum. Page generated in 0.01321 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top