/jasper-reporting-service

Web service for publishing Jasper Reports

Primary LanguageJavaGNU General Public License v3.0GPL-3.0



Jasper Reporting Service

Build Status

Usage

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&param2=test&param3=test

It is important that these parameters are supported in the SQL query string in the underlying .jrxml Jasper template

Docker usage

Run docker image

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

-p 8080:8080

This binds port 8080 of the container to port 8080 on 127.0.0.1 of the host machine.

-v /PATH/TO/CONFIG:/srv/jasper-reporting-service/config/application.properties:ro

Mount your config file to /srv/jasper-reporting-service/config/application.properties with read only mode

-v /PATH/TO/REPORTS:/srv/jasper-reporting-service/PATH_DEFINED_IN_CONFIG:ro

Mount your reports directory to /srv/jasper-reporting-service/PATH_DEFINED_IN_CONFIG with read only mode

Build docker image locally:

docker build . --build-arg JASPER_SERVICE_URL=LINK_TO_JASPER_REPORTING_SERVICE_JAR

How to build it

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

How to run the DEMO 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:

example pdf report