Redirecting BIRT Response to 404 [message #699603] |
Thu, 21 July 2011 17:58  |
Eclipse User |
|
|
|
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 17:12   |
Eclipse User |
|
|
|
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 #726124 is a reply to message #726092] |
Fri, 16 September 2011 12:00  |
Eclipse User |
|
|
|
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.05262 seconds