marianol / JasperServer-for-PHP

JasperReports Server PHP Integration
GNU Affero General Public License v3.0
18 stars 17 forks source link

JasperServer REST Integration Sample

Code: http://github.com/marianol/JasperServer-for-PHP/

Author: Mariano Luna

Version: 2.0.1

Requirements

Using thiis Sample

Once running, go to your web server and login to the sample using a valid Jasper Server username and password (i.e. jasperadmin/jasperadmin)

Instalation Instructions

Quick Overview

Instalation Step by Step How-To

This instructions assume that you already have JasperServer installed and a working Apache Web Server with PHP support. Uncompress the sample source ZIP file in your drive:

<myfolder>/php-sample-app/

Inside that folder you will find 2 folders:

./resources -> libraries and other resources
./web-root  -> application 

1) Configure your Apache web server to add an alias to the Application web-root folder. We will make an alias to our application web root folder, this will put our application in:

http://<your-server-IP>/myphpapp 

Find the httpd.conf (apache configuration file) and add the following:

...
# Alias for PHP APP demo
Alias /myphpapp "<myfolder>/php-sample-app/web_root/"
<Directory "<myfolder>/php-sample-app/web_root/">
    Options Indexes  FollowSymLinks MultiViews ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
...

Change the path slashes accordingly depending on the OS that apache is installed on (windows or unix-like), check the Apache manual.

2) Modify the .htaccess file in web-root, to change the PHP include path, if you want this change can also be made server-wide in PHP.ini

myPEARinstallfolder is your path to php-pear installation folder, this may be in a different path check your php.ini file

3) Restart apache

4) Configure the sample application. Change the paths inside ./resources/config.php

...
// this should match the settings on your httpd.conf file 
// i.e. your application lives in http://localhost/myphpapp
define('WWW_ROOT', '/myphpapp/');
// real OS path where the application is installed
define('SITE_PATH', '/Library/WebServer/Documents/JSDemo/'); 
...
// CHANGE THIS TO POINT TO YOUR JASPER SERVER
define('JRS_HOST', 'localhost');
define('JRS_PORT', '8080');
define('JRS_BASE', '/jasperserver-pro');
...

6) go to: http://localhost/myphpapp and Voila!

The RESTclient.php file has the input control rendering functions and all the meat is in:

- login.php (authentication)
- repository.php (repository browser)
- viewReport.php and executeReport.php (view and execute report)
- iframe.php (iframe UI integration)

External Libraries Used

All the external libraries are included in this sample, check each library folder or website for each individual license.

LICENSE AND COPYRIGHT NOTIFICATION

Copyright (C) 2005 - 2012 Jaspersoft Corporation - All rights reserved.

Unless you have purchased a commercial license agreement from Jaspersoft, the following license terms apply:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.