Search code examples
javajsfjasperserver

Integrating Jasper Reports from Jasper Report Server in web application


I am trying to display Jasper reports from Jasper Report Server on my JSF web application, but I am not able to find any documentation or resource that describe how to achieve it. I am currently using Jasper reports in my project, but I am planning to move the reports to Jasper Report Server for better performance and maintenance and access the reports from the Jasper report server using any adaptor or library.


Solution

  • Solution 1:

    I am answering to help anyone searching for similar question.

    I am able to integrate JR Server using jrs-rest-client. Here is my sample code

    RestClientConfiguration configuration = new RestClientConfiguration("http://localhost:8080/jasperserver");
    JasperserverRestClient client = new JasperserverRestClient(configuration);
    Session session = client.authenticate("user", "password");
    
    OperationResult<InputStream> result = session
        .reportingService()
        .report("/E_Reports/myReport")
        .prepareForRun(ReportOutputFormat.PDF, 1)
        .parameter("param", "702558")
        .run();
    
    InputStream report = result.getEntity();
    

    Solution 2:

    There is another solution. I find on this link.

    https://community.jaspersoft.com/questions/815042/run-report-using-restv2-and-java