8

I have Jasper Reports Server (installed on www.example.com) and a separate Java/JSP application (installed on www.example.net), and I am pursuing different options for generating reports.

Option 1 (current working solution)

My current working solution is that the user logs into the Java/JSP application, and selects a report. The application creates an XML representation of the report, which it saves as fileNameXML and then it then sends it to the Jasper Reports Server using code such as the following:

     <IFRAME height="600" width="1000" src="https://www.example.com/jasperserver/flow.html?
    _flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&
    ParentFolderUri=%2Freports&
    reportUnit=%2Freports%2FExample_Report_2&j_username=user&
    j_password=password&
net.sf.jasperreports.xml.source=https://www.example.net/<%=fileNameXML%>">                              
     </IFRAME>

(Note that even though I pass a username and password in the URL, security is not compromised because the filenameXML is created using String fileName = UUID.randomUUID().toString() + fileExt;)

Option 2

I connect Jasper Reports server directly to the SQL Server database on www.example.net, and produce reports that way. The disadvantage of this approach is that (a) I would need to set up all the users in Jasper Reports (b) I would need to pass parameters in a security-conscious way so that each user can only access their own data (c) I only have access to the database, and not to the calculations of my application

My Ideal Solution

However I would really like to be able to access the calculations of my application via Jasper, and bypass logging in to my application.

One advantage of this, is that my application does not yet have proper mobile access, and the users could download the Jasper Mobile Application app and access the reports from there.

This would involve the following:

  1. User logs into Jasper
  2. User selects report
  3. Jasper calls my application with certain parameters
  4. Application creates xml file
  5. Application returns a link to this file
  6. Jasper shows report

What is the best way of achieving this?

gordon613
  • 2,770
  • 12
  • 52
  • 81

1 Answers1

0

I think the best way to do this is to:

  • Create a URL in your app that is accessible anytime and does not require logging in. If you're using Spring or any other framework, stating that would be good as I could show you how to do this.

There are a lot of ways to skin this cat. Let me know what technologies you're using and maybe we can start from there. We've implemented the requirement you're having right now.

Thank you.

Miki
  • 103
  • 1
  • 11
  • How are you handling your login / session tracking? Again, the concept, since it's a concept, is vague. And you're asking an approach to the problem which is what I'm trying to figure if it works for you. If I were to implement this, using Spring. I'd have an Interceptor that checks for URL requests coming into my app. If I hit a specific URL, say, 'myApp/getCalculations', I would bypass the login / session checking functionality and provide the requestor all the information it needs, maybe through a serialized object, string, json, etc (whatever the requestor understands). Cheers! – Miki Jul 22 '15 at 06:58
  • Thank you for replying. Let us say that I create a URL that does the calculations (and bypasses the login as you suggest), how would you suggest that jasper communicates with this URL. Specifically how would it call it, and how would it receive the XML data which this URL would produce? – gordon613 Jul 23 '15 at 09:58