How to automatically load a report on home page after logged in Jasper Server Community - jasperserver

In Jasper Server Community Edition, I want to load a report automatically without clicking on any report when I logging. I tried to add below code to home.jsp page as jasperSoft documentation says.but it is not working.
Please help me with this.
Code that I added to home.jsp :-
<%
<authz:authorize ifAllGranted="ROLE_REPORT_HOME">
<c:redirect
url="http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&ParentFolderUri=%2Freports&reportUnit=%2Freports%2FSample_Dash_Report&standAlone=true"/>
</authz:authorize>
%>

Please make sure to follow all the steps in the tutorial, as you probably missed to add user role to the user you want. Also, make sure to have sample data as you're referencing report from sample data.
Setting a report as the home page:
The following example shows how to set a report as the home page based on a role. This example uses the 01. Geographic Results by Segment Report.
First, set up the role and create a sample user:
a. Create the role you want to use, for example, ROLE_REPORT_HOME.
b. Create a user HomeUser and add ROLE_REPORT_HOME to HomeUser.
Open the file \WEB-INF\jsp\modules\home\home.jsp in an editor and add the following lines:
<authz:authorize ifAllGranted="ROLE_REPORT_HOME">
<c:redirecturl="http://localhost:8080/jasperserver-pro-601/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Fpublic%2FSamples%2FReports&reportUnit=%2Fpublic%2FSamples%2FReports%2F01._Geographic_Results_by_Segment_Report"/>
</authz:authorize>
To find the URI for the report you want to use, open the report in the repository and copy the URI.
Save the modified file and restart the application server to see changes.
Log into JasperReports Server as HomeUser. The library page is displayed.

Go to Jasper server installation directory and search for jasperserver-servlet.xml (C:\Jaspersoft\jasperreports-server-cp-6.4.2\apache-tomcat\webapps\jasperserver\WEB-INF\jasperserver-servlet.xml)
Under bean id = "homePageByRole" we have to make changes. For that, search homePageByRole word inside the jasperserver-servlet.xml file.
Under tag ,we can give a report link we need according to the user roles. But make sure you should add amp; as after each & mark. Otherwise it will give an error!
Example:-
Original report link from the address bar in browser when report opened using jasper server is;
http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&ParentFolderUri=%2FMy_Reports&reportUnit=%2FMy_Reports%2FDashboard_Report_Landscape&standAlone=true
But the link we should put under is;
ROLE_USER|redirect:/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&ParentFolderUri=%2FMy_Reports&reportUnit=%2FMy_Reports%2FDashboard_Report_Landscape&standAlone=true
check how we add as amp; after every & mark. Also we can set user role. In my case I set user role as ROLE_USER.
Whole code snippet is;
<bean id="homePageByRole" class="java.util.ArrayList">
<constructor-arg index="0" type="java.util.Collection">
<list>
<value>ROLE_ADMINISTRATOR|redirect:/flow.html?_flowId=searchFlow</value>
<value>ROLE_USER|redirect:/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&ParentFolderUri=%2FMy_Reports&reportUnit=%2FMy_Reports%2FDashboard_Report_Landscape&standAlone=true</value>
</list>
</constructor-arg>
</bean>

Related

"Client Error" message when trying to implement an Rest API View

I'm creating an API with Drupal to serve a angular application. The problem is, when I create the view with Rest export and try to access it (via browser or postman), it gaves me an "Client error" message (and nothing more).
I'm using drupal-8.7.6, running with PHP7.3, mysql and apache 2. But I've tried at nginx also and the error appeared again.
To reproduce it, just add some contents, enable the Restful web services, jsonm hal and create a view that exports rest data.
I expect to access the information via GET request (using browser, postman or any other way)
Go to your View
Go to Format
Click on Settings beside Serializer
Finally check Json option and save.
You are done :)
find out what was happening
I was not specificating the format of output, so Drupal was searching for an html to serve. To workaround this, just add to url: ?_format=json, for example, if my view route is "/articles", it will be: http://drupal.dev/articles?_format=json
Go to the rest exports view, click on format setting and click accepted request format to json.

How to get name of report used by different user in jasperserver

I am using jasper server enterprise version 7.0. Multiple users login to the server I can get the user name by using parameter - LoggedInUsername. But how can i get which report is used by the Logged in user. Is there any method to do so or is there any workaround for this?
Inside a report template (JRXML), you can get its own name calling $P{JASPER_REPORT}.getName():
And this is what you see when it's published to the server (6.4.2 in my case):
As you can see from the screenshot, the report file name and report name do not necessarily have to match.
For further details, see: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRParameter.html#JASPER_REPORT

Unable to use Liferay Freindly URL Mapper

I was following this document from Liferay Website to work Map Firendly URL Mappings
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/adding-friendly-url-mapping-to-the-portlet
I am using Liferay version=6.1.0
During HyperLink navigation , i was getting the following url
http://localhost:8080/web/guest/what-we-do?p_p_id=sai_WAR_Saiportlet&
p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1
&_sai_WAR_Saiportlet_jspPage=%2Fhtml%2Fsai%2Fedit.jsp
To modify the above i have tried to use Friendly URL Mapper and i have done the following way
Inside liferay-portlet.xml file .
<portlet>
<portlet-name>sai</portlet-name>
<icon>/icon.png</icon>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>sai</friendly-url-mapping>
<friendly-url-routes>com/test/sai-friendly-url-routes.xml</friendly-url-routes>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<css-class-wrapper>sai-portlet</css-class-wrapper>
</portlet>
Created a new file by name sai-friendly-url-routes.xml inside
D:\liferay-plugins-sdk-6.1.0-SNAPSHOT\portlets\Sai-portlet\docroot\WEB-INF\src\com\test\sai-friendly-url-routes.xml
The content inside sai-friendly-url-routes.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 6.1.0//EN" "http://www.liferay.com/dtd/liferay-friendly-url-routes_6_1_0.dtd">
<routes>
<route>
<pattern>/{mvcPathName}</pattern>
<generated-parameter name="mvcPath">/{mvcPathName}.jsp</generated-parameter>
</route>
</routes>
But i observed there is no change in the url
http://localhost:8080/web/guest/what-we-do?p_p_id=sai_WAR_Saiportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_sai_WAR_Saiportlet_jspPage=%2Fhtml%2Fsai%2Fedit.jsp
Please let me know where exactly i am doing mistake .
You leave the values as they are. That is, you leave {mvcPathName} and "mvcPath" as-is.
When the friendly URL is generated, it parses mvcPath (i.e., edit.jsp or view.jsp) from the URL and then the pattern is applied, replacing .../edit.jsp with .../edit.
This example works for the edit JSP. And it works for the view page; but NOT when clicking Save ... which is something I could look into. However, if you go to edit and then click the back link, the friendly URL will show for the view JSP.
I've created a ticket to complete this example so that it also goes to a friendly URL when clicking save. I'll update this section when we've made the fix.
Thanks.

Requesting Report with URL Parameters

My issue is exactly the same as Mr. John Ortega's described here.
However, both of the proposed solutions have not worked for me.
If I replace "Report.aspx" with "ReportViewer.aspx" in the Report Manager URL (ex: "http://servername/Reports/Pages/Report.aspx?ItemPath=%2fFolder+1+Name%2fFolder+2+Name%2fReport+Name"), I'm given a 404.
If I use the Web Service URL structure instead (ex: "http://servername/Reports?/Folder 1 Name/Folder 2 Name/Report Name"), I just get redirected back to the home page of my report server (which is "http://servername/Reports/Pages/Folder.aspx").
So I'm not really given an opportunity to pass report parameters via URL parameters, because the report itself won't come up.
If your requirement to jump to any other report in the same report server and directory, you can use “go to report” option instead of using “go to URL”.

Wrong Date Format (locale) in SQL Server Reporting Services Report

I am unable to solve an issue with a report on SSRS.
The scenario is : a link in a Silverlight application loads a new web page containing a Microsoft.Reporting.WebForms.ReportViewer control. The parameters for the control are passed in the QueryString to the new page.
If the date is passed as 01/08/2011, when the report is loaded, the date control on the report viewer has the value 08/01/2011 (i.e. it has been converted to American format and my locale is United Kingdom, en-GB).
This only happens in the deployed solution, it works correctly in Visual Studio on my local PC. My IE settings are correct.
I made the following checks on the deployed IIS Server (IIS 6.0):-
The security account for the relevant Application Pool = Network Service.
In the Registry the SID for this user is S-1-5-20 so I checked the registry settings under HKEY_USERS > S-1-5-20 > Control Panel > International . These were all correctly set for United Kingdom. Although theoretically they should not have an effect I also checked the same settings for Local System (S-1-5-18) and NT-Authority (S-1-5-19) which were identical.
I next checked the Culture and UI Culture on the web site. These were as follows: -
Right-click website - Properties > ASP.NET.
Click the 'Edit Global Configuration' button to check the server config settings.
Select the Application tab and view the values for Culture and UI Culture.
Both values are set as en-GB. So OK.
Did the same in the 'Edit Configuration' button which is for viewing/editing the specific application's config file.The websites' config file values will supercede the server config file values. These are also OK.
Next I checked the SSRS Server.
Service runs under 'Local System' account.
Registry settings for this account are correct HKEY_USERS > S-1-5-18 > Control Panel > International.
S-1-5-19 and S-1-5-20 also correct
ReportServer.aspx page directive includes Culture="en-GB"
(e.g. <%# Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" Culture="en-GB"%>)
In code the parameter values are set using Microsoft.Reporting.WebForms.ReportViewer.SetParameters(ms.ReportParameter []) and ms.ReportParameter(name, value, visible) and the parameters are definitely the correct value when they are received at this point by the web app (when I step through in code).
I don't know where to turn next. The one difference I have but I can't imagine it is the problem is that the querystring is URLEncoded on the deployed version but not in the design on my local PC i.e
[server version]
...%26END_DATE%3d31%2f07%2f2012+00%3a00%3a00%26START_DATE%3d01%2f08%2f2011+00%3a00%3a00
[local version]
...&END_DATE=31/07/2012+00:00:00&START_DATE=01/08/2011+00:00:00
I would be extremely GRATEFUL for any suggestions that anyone has.
If you pass in the date in dd-mmm-yyyy format then it is unabiguous, eg 18-Jan-2011.