Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Reading cookies
vlodha
How can I validate whether a cookie is present or not in BIRT report initialization? I want to check if "USER" cookie is present then only report should be accessible else redirect to error page.
Find more posts tagged with
Comments
averma
Hi vlodha:
Are your using the BIRT sample viewer? If so then use the following script in beforeFactory:
var request = reportContext.getHttpServletRequest();
cookies = request.getCookies();
Now you can iterate through the cookies to get the value of "USER" cookie.
AV
vlodha
I am able to read the cookies but how do I redirect to error page ?
In my XML file am adding following:
<method name="beforeFactory"><![CDATA[
var request = reportContext.getHttpServletRequest();
var cookies = request.getCookies();
var i =0;
var flag = 0;
do{
if(cookies[i++].getName().equals("USER")){
flag = 1;
}
}while (i < cookies.length)
if(flag != 1){
//redirect to error page....
}
]]></method>
rmurphy
If you want to redirect to an error page, you should perform your check outside of the BIRT Report. One way of doing this would be with a ServletFilter. <br />
<br />
You could also have some script in your report to simply show a message to the user that they don't have access.<br />
<br />
Alternatively, the Actuate BIRT Viewer has a security extention point that allows you to integrate the viewer with your application to offer users a seemless experience. You can see more about this extension point here:<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/wiki/Security_Integration_with_the_Actuate_BIRT_Viewers/'>Security
Integration with the Actuate BIRT Viewers - BIRT Wiki - BIRT Exchange</a><br />
<br />
Rob