i-net Clear Reports

Implementation as client / server java application

1. Integrate i-net Clear Reports in your own client / server Java application

Server

On the server side you need to start the report listener in your application. After the report listener is started it listens for report requests. If a new report request has been received the listener does the following:

  • Open a new socket for this report request.
  • Create a new engine for the report request if necessary or if an engine for this client already exists in the engine pool then the engine from the pool will be used.
  • Send the parameter from the request to the engine.
  • Send the executed report back to the viewer.

The following line starts the report listener thread:

// Create the Listener that listens for report requests and
that hands the report requests over to the engine
 
static Listener reportListener = new Listener();

Tip: Add this line to the main class (java file that contains the main() method) of your server application.

Client

The Java viewer can be integrated in a Java application or a Java applet on the client side. To do this you need to add the report viewer to your code. The following two examples show the integration of the report viewer in a Java application or in a Java applet.

Client as Java application

This example shows the report viewer javabean in a new window that will be opened after a button is clicked:

 …
// Create a target window for the viewer
Window window = new Dialog(this, "Report Viewer");
window.setSize(Toolkit.getDefaultToolkit().getScreenSize());
window.show();
 
// Create the Report Viewer
SwingReportViewer viewer = new SwingReportViewer();
 
// Create the connection to the report server
URLRenderData myConnection = new URLRenderData(requestString);
 
// Create the report view and set the connection to the report server
viewer.addNewReportView(myConnection);
 
// Add the report viewer to the window
window.add( BorderLayout.CENTER, viewer);

After creation of the new window and the report viewer the following values need to be configured:

  • hostname and port number of the server application
  • report URL and report name
  • necessary parameters for the report ( e.g. prompt, …)

These values are sent by the report viewer as a request to the report engine (requestString). An example for a request string looks like:

http://<hostname>:<portnumber>?report=file:C:/reports/reportfile.rpt&datasource=MySQLServer
# (The path of the report file must be a path on the server).

To set the requestString you can use a text field or other components (e.g., other text components) to set the report name and the necessary parameters. Another example for setting the report name is to read it from a database where all locations of the reports are saved.

Client as Java applet

In an applet you can add the report viewer javabean to a panel (as an example)

// Create the Report Viewer
SwingReportViewer viewer = new SwingReportViewer();
 
// Create the connection to the report server
URLRenderData myConnection = new URLRenderData(requestString);
 
// Create the report view and set the connection to the report server
viewer.addNewReportView(myConnection);
 
// Add the report viewer to the panel
add("Center", viewer);

After creation of the report viewer the following values need to be configured:

  • hostname and port number of the server application
  • report URL and report name
  • necessary parameters for the report ( e.g. prompt, …)

These values are sent by the report viewer as a request to the report engine (requestString). An example for a request string looks like:

http://<hostname>:<portnumber>?report=file:C:/reports/reportfile.rpt&datasource=MySQLServer

To set the requestString you can use a text field or other components (e.g., other text components) to set the report name and the necessary parameters. Another example for setting the report name is to read it from a database where all locations of the reports are saved.

2. Using i-net Clear Reports as a Java server application

If you do not have a Java application on the server side in that you can integrate i-net Clear Reports or you don't like to implement a server application you can use i-net Clear Reports as Java server application and thus only need to implement the client.

Server

In this case you use i-net Clear Reports as Java application without the integration in your Java application. To do this follow the steps of the application installation.

After you have installed the Java server application i-net Clear Reports you can request reports from a client.

Client

The Java viewer can be integrated in a Java application or a Java applet on the client side. To do this you need to add the report viewer to your code. See the section above for two examples that show the integration of the report viewer in a Java application or in a Java applet.

See Also:


i-net software strives to provide accurate product documentation. Please give us your feedback using the form below.
NOTE: This form is for documentation feedback only. For technical assistance, please send an email to clearreports@inetsoftware.de.

 

© Copyright 1996 - 2012, i-net software; All Rights Reserved.