Skip to main content



      Home
Home » Archived » BIRT » reportContext.getHttpServletRequest() returns null
reportContext.getHttpServletRequest() returns null [message #189498] Fri, 08 September 2006 01:37
Eclipse UserFriend
Originally posted by: fred.fmost.com

I'm banging my head against a wall trying to get some dynamic information
from the container session into a BIRT report so that I can set the JNDI
property based on runtime information. I started using the examples from
the website for getting session variables, but the BIRT logs report null
when using:
reportContext.getHttpServletRequest() in javaScript.So I thought I'd do a
little debugging in Eclipse by sending the ReportContext to a java class and
interrogating the ReportContext. This is the Javascript in datasource
before open:
importPackage(Packages.com.ghd.admin.util)
DataSourceClass = new ExternalSecurity(reportContext);
this.setExtensionProperty("odaJndiName",DataSourceClass.getJndiName());

I'm using Ecplise (of course) and Sysdeo as the tomcat plugin for debugging.
I set a break point in the constructor, adn can get alot of great
information out of the IReportContext object, but the HttpServletRequest is
still null. Here is the ExternalSecurity class.
_______

package com.ghd.admin.util;


import javax.servlet.http.HttpServletRequest;


import org.eclipse.birt.report.engine.api.script.IReportContext;


public class ExternalSecurity {

String jndiName;

public ExternalSecurity(IReportContext reportContext) {

Object object = reportContext.getHttpServletRequest();

if (object == null){

System.err.println("getHttpServletRequest returned null");

}else{

HttpServletRequest hsr =
(HttpServletRequest)reportContext.getHttpServletRequest();

String pjndiName =(String) hsr.getSession().getAttribute("jndiName");

setJndiName(pjndiName);

}

}

/**

* @return the jndiName

*/

public String getJndiName() {

return jndiName;

}

/**

* @param jndiName the jndiName to set

*/

public void setJndiName(String jndiName) {

this.jndiName = jndiName;

}

}

I can't help but think that this is a some glitch with my Development
Environment, otherwise many more people would have reported problems. I did
see another similar issue on another forum
http://www.eclipsezone.com/eclipse/forums/t75089.html with the same error
message in the BIRT logs [Cannot call method "getSession" of null]. I also
a saw a Bugzilla issue that may be related
https://bugs.eclipse.org/bugs/show_bug.cgi?id=123705 having to do with class
loaders, but I could not really gleen the fix.

Any help would be much appreciated,

Thanks,

Fred Forester
Previous Topic:compile error
Next Topic:Multiple Parameters
Goto Forum:
  


Current Time: Sun Nov 09 17:19:41 EST 2025

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

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

Back to the top