You’ll build a service that will accept HTTP GET requests at:
http://localhost:8080/reports/PieChartReport/?format=pdf&MaxOrderID=10800
and respond with a link:Jasper Report Document in the format you specified (pdf / html / csv / xls / xlsx
)
You can customize the request with optional parameters
in the query string:
http://localhost:8080/reports/PieChartReport/?format=pdf&MaxOrderID=10800&ReportTitle=test¶m2=test¶m3=test
It is important that these parameters are supported in the SQL query string in the underlying .jrxml
Jasper template
docker run \ -p 8080:8080 \ -v /PATH/TO/CONFIG_FILE:/srv/jasper-reporting-service/config/application.properties:ro \ -v /PATH/TO/REPORTS:/srv/jasper-reporting-service/PATH_DEFINED_IN_CONFIG:ro sourcepole/jasper-reporting-service
docker parameters | Description |
---|---|
|
This binds port 8080 of the container to port 8080 on 127.0.0.1 of the host machine. |
|
Mount your config file to /srv/jasper-reporting-service/config/application.properties with read only mode |
|
Mount your reports directory to /srv/jasper-reporting-service/PATH_DEFINED_IN_CONFIG with read only mode |
Build requirements:
-
java_version: 1.8
-
maven: >3: (for building the project if you wish to)
use the following command in the cloned directory:
mvn package
Download the latest release from here: Releases
Download the "config" and "demo" directories from github
Folder structure should look like this:
- config --application.properties - demo --data --fonts --reports - jasper-reporting-service.jar
Install the FONTS on your system from demo/fonts
Run SQL from data/h2_data.sql
against your Demo-Database (in-memory H2 database is pre-configured!)
If you wish to use the pre-configured H2 database activate the "h2 console" in config/application.properties
and run the SQL script in the GUI: localhost:8080/h2
Run with command:
java -jar jasper-reporting-service.jar:
test with:
http://localhost:8080/reports/PieChartReport/?format=pdf&MaxOrderID=10800
You should get a nice looking PDF-Report looking like this: