BIRT Exchange Forum: Passing parameters through URL - BIRT Exchange Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Passing parameters through URL Rate Topic: -----

#1 User is offline   devp 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 11-August 08

Posted 26 September 2008 - 10:51 AM

Hi
I am using Actuate iServer Express and have reached a roadblock. I would appreciate any help.

I have a cascading parameter group, where the first parameter to be populated depends on the userid of the user accessing the report. To get the parameter list populated, I created a dataset and attatched an eventhandler to it, so that I could change the query at the 'beforeOpen' event. The idea was to pass the user id through the request. But unfortunately when I do the following:

reportContext.getHttpServletRequest(); 



I always get a null as the return value. How can I pass the user id ?
This is urgent, please help.

Thanks and Best Regards
devp
0

#2 User is offline   devp 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 11-August 08

Posted 28 September 2008 - 11:47 PM

I am using iServer Version: 9 Service Pack 3 Fix 3A (Build 90F080509). Is this a bug? Are there any known workarounds?

Thanks
devp
0

#3 User is offline   rmurphy 

  • Senior Member
  • Group: Members
  • Posts: 307
  • Joined: 09-August 07

Posted 29 September 2008 - 05:14 AM

The iServer Express always passes the logged in user to the reportContext in the ServerUserName variable. The following DevShare entry shows how to get the value from the variable and alter the query in the Data Set's beforeOpen event.

Filter BIRT JDBC Query - Designs & Code - BIRT Exchange

Rob
0

#4 User is offline   devp 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 11-August 08

Posted 29 September 2008 - 05:28 AM

Hi Rob
Thank you for the reply. I was able to pass the userid using that technique.
But the other query is, this way I can only pass the user id. If it is required to pass other parameters how do I achieve that?
Also why does getHttpServletRequest always return null? Is this the way it is supposed to work? Some of my design decisions will depend on the answer to that.

Thanks again.

devp
0

#5 User is offline   rmurphy 

  • Senior Member
  • Group: Members
  • Posts: 307
  • Joined: 09-August 07

Posted 29 September 2008 - 10:29 AM

When using the iServer Express, report requests are sent over a web service call. Since you can use these web services directly you are not guaranteed to have a HttpServletRequest. Therefore, you are better suited to pass other values into the report using parameters. If you use hidden parameters, the user will not be prompted for them. Here is an example of a URL passing a parameter to the report design:
http://localhost:8900/iportal/executereport.do?__executablename=/PathToReport/ReportName.rptdesign&MyParam=ParamValue&invokesubmit=true


It is expected behavior for the HttpServletRequest object to be null.

Rob
0

#6 User is offline   devp 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 11-August 08

Posted 29 September 2008 - 09:48 PM

Hi Rob
Thanks again for the clarification. I do want the user to select the parameters but for the first query in the cascaded parameter. In effect I want users to select/set some parameters and want to set some other parameters automatically. In the present scenario it is 'all or nothing'. Is there a workaround?

Thanks
devp
0

#7 User is offline   devp 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 11-August 08

Posted 02 October 2008 - 06:59 PM

rmurphy said:

When using the iServer Express, report requests are sent over a web service call. Since you can use these web services directly you are not guaranteed to have a HttpServletRequest.


It is expected behavior for the HttpServletRequest object to be null.

Rob


Hi Rob,
I did not quite understand the argument put here. Can you please calrify a bit more? What is the reason the function
 reportContext.getHttpServletRequest()
exist? To interact with the users' session?

Thanks
devp
-1

#8 User is offline   rmurphy 

  • Senior Member
  • Group: Members
  • Posts: 307
  • Joined: 09-August 07

Posted 02 October 2008 - 07:23 PM

In cases where you are using the BIRT Engine and setting the PlatformContext to use a ServletContext you will have access to the HttpServletRequest.

Since the iServer Exposes itself via web services that could be called from virtually any type of application, the Platform that is started up inside the iServer Express is likely not started using a ServletContext and therefore the HttpServletContext is not exposed.

Rob
0

#9 User is offline   devp 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 11-August 08

Posted 06 October 2008 - 02:21 AM

Thanks for the explanation Rob.

Best Regards
devp
0

#10 User is offline   arielcamus 

  • Junior Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-March 09

Posted 10 March 2009 - 03:54 AM

Hi devp,

I think it will be to late to answer your question. But it's maybe not to late for other people.

The problem is Java doesn't include javax.servlet into the API. So, you have to download the library and include it into your build PATH.

I'm currently using Maven, so I just have to run "Add dependency" or include a new dependency in my project pom file.

Anyway, after including the library javax.servlet, just upcast the object resulting of calling "reportContext.getHttpServletRequest();".

Do it this way:

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

After that, you can work with the HttpServletRequest object calling its getQueryString() or every other HttpServletRequest method.

i.e. String request = request.getQueryString());


I've spent few hours until I got the answer. I hope it will help you.
0

#11 User is offline   neetira 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 12
  • Joined: 17-March 09

Posted 19 March 2009 - 09:26 AM

arielcamus said:

Hi devp,

I think it will be to late to answer your question. But it's maybe not to late for other people.

The problem is Java doesn't include javax.servlet into the API. So, you have to download the library and include it into your build PATH.

I'm currently using Maven, so I just have to run "Add dependency" or include a new dependency in my project pom file.

Anyway, after including the library javax.servlet, just upcast the object resulting of calling "reportContext.getHttpServletRequest();".

Do it this way:

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

After that, you can work with the HttpServletRequest object calling its getQueryString() or every other HttpServletRequest method.

i.e. String request = request.getQueryString());


I've spent few hours until I got the answer. I hope it will help you.


Hi arielcamus,

I am trying the same in MyEclipse BIRT Report. when I tried the following statement:
HttpServletRequest request = (HttpServletRequest) reportContext.getHttpServletRequest();

I got an error that "Missing ; before statement" after HttpServletRequest request

if i put
var request = (HttpServletRequest) reportContext.getHttpServletRequest();

I get the same error at a different place - after reportContext

only if I put
var request= reportContext.getHttpServletRequest();

there is no error but the value is null...

is there some other way out?

neeti
0

#12 User is offline   sonimanish 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 12
  • Joined: 04-February 10

Posted 10 March 2010 - 10:40 PM

Thanks for solutions,

But when am trying this link in my application. it throw me on iserver express login page.
Once i logged in link redirected to report.

i want to avoid this login screen my writing some code in code behind.
please guid me how.


please mail me solutions on my mail id

Thanks
manish soni
manuroshan2003@yahoo.co.in
india
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users