It's all about the answers!

Ask a question

Howto get the SERVER_URL within a Birt report?


Guido Schneider (3.4k1385114) | asked Jul 01 '12, 1:15 p.m.
edited Jul 01 '12, 1:16 p.m.
I would like to display the Server URL within a Birt report.
Following statement is returning me just "null".

reportContext.getAppContext().get("SERVER_URL")

Any idea what I'm missing or what I have not correctly configured on the server, so BIRT would know the Server URL?

Comments
Guido Schneider commented Aug 26 '12, 3:24 p.m.

Has somebody successfully implement this in BIRT?

Accepted answer


permanent link
Rafik Jaouani (5.0k16) | answered Oct 01 '12, 7:02 p.m.
JAZZ DEVELOPER
reportContext.getAppContext().get ("SERVER_URL") will only return non null if it is necessary; i.e., a report is being displayed with data coming from a different server.

So 99 % of the time, you should use a relative URL.


Guido Schneider selected this answer as the correct answer

Comments
Erwin Kunz commented Oct 02 '12, 2:08 a.m. | edited Oct 02 '12, 2:09 a.m.

Hi Rafik, thank you for the info. Now it make sense. Actually everything works fine in my case because I force ServerURL to "" in case of Null , and Guido probably not,

In our case I we can probably just use "/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/"

erwin

One other answer



permanent link
Erwin Kunz (94686486) | answered Sep 29 '12, 5:58 a.m.
 I use following code in the hyperlink of a field

var serverURL = reportContext.getAppContext().get ("SERVER_URL"); 
if (serverURL == null) serverURL = ""; 
serverURL + "/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/"+row["WI_ID"]

Your answer


Register or to post your answer.