|
Re: Redirecting BIRT Response to 404 [message #699940 is a reply to message #699603] |
Fri, 22 July 2011 15:09 |
|
I am not certain this will work for you but you could set a global
variable in the script and then add a text element with script in it to
auto forward based on the global variable. Take a look at the attached
example. Look at the parameter validation script and the text element.
Jason
On 7/21/2011 5:58 PM, paula.mcdowell wrote:
> Hi, there. I'm using BIRT 2.6.2. In my report design, I have added
> javascript in my initialize to call a Java object passing it the
> HttpServletRequest from the report context. The java object does some
> validation with the HttpServletRequest. I'd like to redirect the user to
> a 404 Error if the request does not past the validation. Is there a way
> to do this?
> Thank you in advance for you time,
> Paula
|
|
|
|
Re: Redirecting BIRT Response to 404 [message #702016 is a reply to message #701991] |
Mon, 25 July 2011 21:12 |
|
Drop the table that uses the dataset in the beforeFactory script. If no
report item uses the data the query should not run. Name the table in
the general properties and drop it like:
reportContext.getDesignHandle().findElement("mytable").drop();
Jason
On 7/25/2011 4:41 PM, paula.mcdowell wrote:
> Jason,
> This works great for forwarding to another page. Thank you, thank you.
> The problem is it's still executing the database query. I have a
> scripted datasource.
>
> I added a global variable as you suggested, and I check it in the
> initialize event of my report. At that point, if validRequest is false,
> I want to forward to the error page and stop the backed processing of
> the report.
>
> Is there anyway to stop the report from executing? I've noticed this
> thread,696694. I've tried to drop the datasource in the beforeOpen
> event, but this did not work. Database query was still executed.
>
> Thanks for all your help,
> Paula
|
|
|
|
Re: Redirecting BIRT Response to 404 [message #702840 is a reply to message #702732] |
Tue, 26 July 2011 21:54 |
|
what do you mean inner class? Any class in the cp? If so the answer is
yes. If you want to do this from script use the importPackage command.
Assume you have a class in my.package.MyObject use:
importPackage(Packages.my.package);
var tst = new MyObject();
Jason
On 7/26/2011 2:22 PM, paula.mcdowell wrote:
> I got this to work, Jason. Thank you. Another un-related question. And
> let me know if you want me to start a new thread. Can I instantiate an
> inner class from the BIRT events?
>
>
|
|
|
|
|
Re: Redirecting BIRT Response to 404 [message #703400 is a reply to message #702863] |
Wed, 27 July 2011 14:04 |
|
Paula,
I am not sure I understand what you are trying to do.
Jason
On 7/26/2011 6:32 PM, paula.mcdowell wrote:
> Jason,
> Moreso like OuterClass.InnerClass innerObject = outerObject.new
> InnerClass();
>
> Can I instantiate this type of object in the BIRT event handler?
>
> Thank you,
> Paula
|
|
|
|
Re: Redirecting BIRT Response to 404 [message #705226 is a reply to message #704588] |
Fri, 29 July 2011 15:29 |
|
Paula,
Thanks for the clarification. I am not certain Rhino (Which is the
script engine BIRT uses) supports this. As a work around you could
always use a Java event handler and do it in a java class.
Jason
On 7/28/2011 4:27 PM, paula.mcdowell wrote:
> Jason,
> I'll do my best to explain. And really I have a work around, but I was
> wondering if inner classes can be created in BIRT scripts.
>
> I have a class A that has method getRows which executes a prepared
> statement. I iterate through the result set creating objects of class B.
> What is returned from A.getRows() is an ArrayList of B. B is a public
> inner class of class A. In Java, I would instance class B as follows:
> A.B b = a.new B();
>
> Since my getRows is a List of A.B, I need to be able to create this
> object in the BIRT script. I really hope I've added some clarity.
>
> Thank you for your time,
> Paula
|
|
|
|
|
Re: Redirecting BIRT Response to 404 [message #714866 is a reply to message #714549] |
Thu, 11 August 2011 14:37 |
|
I do not know of a way to to get the response object, but you can always
forward to another page using some script in text element (client side
script). You could do this conditionally based on a server side variable.
<script type="text/javascript">
function forward() {
var temp = new String(location.href);
location.replace("http://www.google.com");
return false;
}
if( <VALUE-OF>params["forward"].value</VALUE-OF> ){
forward();
}
</script>
Jason
On 8/10/2011 3:49 PM, paula.mcdowell wrote:
> Thanks, Jason.
>
> Is there anyway to get at the HttpServletResponse from the BIRT event
> handlers? Calling a Java Class, I'd like to authenticate the request. I
> can easily pass the HttpServletRequest to my Java Class, but I'm missing
> the HttpServletResponse.
>
> Thanks for your time,
> Paula
|
|
|
|
Re: Redirecting BIRT Response to 404 [message #726124 is a reply to message #726092] |
Fri, 16 September 2011 16:00 |
|
Marc,
You can get access to the request object from the ReportContext but not
the response so I do not think there is an easy solution here. One way
may be to add a text element to the top of the report that is dropped in
the beforeFactory if the user is valid. The text element could contain
a simple script (client side) that replaces the current location with an
error page. If the user is not valid drop the other report items, if
they are valid drop the text element. To drop in the beforeFactory,
name you elements and use script similar to
reportContext.getDesignHandle().findElement("mytable").drop();
Jason
On 9/16/2011 10:30 AM, marc.marshall wrote:
> Jason,
>
> I have a situation were I am validating the user that is accessing my
> Birt Report. If the User is deemed invalid then I would like to display
> a 403 Error (Forbidden). Is there any way of forcing this error within a
> Java Event handler? The only object that I have in the report
> intilization Event Handler is the ReportContext but it does not appear
> that I can force this Error. Do you have any suggestions?
>
> Thanks in advance for any help and expertise,
>
> Marc M.
|
|
|
Powered by
FUDForum. Page generated in 0.03556 seconds