Class JasperServer::Client
In: lib/jasper_server/client.rb
Parent: Object

The client through which all report requests are sent to the JasperServer.


Public Class methods

Create a new instance of the client.

url :The URL of the JasperServer. This should look something like: ":/jasperserver/services/repository"
username :The username used to connect to the JasperServer.
password :The password used to connect to the JasperServer.

Public Instance methods

Request a report from the server based on the ReportRequest object you provide. Returns the report data.

For example if your request specifies PDF as the output format, PDF binary data will be returned.

  client ="",
                                    "jasperadmin", "secret!")
  request ="/example/my-report", "PDF", {'fruit' => 'apple'})
  pdf_data = client.request_report(request)'/tmp/report.pdf', 'w') do |f|

For debugging purposes, try requesting output in CSV format, since request_report will then return an easily readable String.