Using the Server API
This topic shows how to use Logi JReport Server API to achieve specific goals.
The HTTP methods GET and POST are available for almost all of Logi JReport commands. The following is an example of using the POST method in Java program:
URL url = new URL("http://jrserver:8888");
URLConnection uc = url.getConnection();
if (uc instanceof HttpURLConnection) {
HttpURLConnection huc = (HttpURLConnection)uc;
//set use POST method.
huc.setRequestMethod("POST");
huc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
huc.setDoOutput(true);
//write the HTTP query to the output stream.
OutputStreamWriter writer = new OutputStreamWriter(huc.getOutputStream());
writer.write("jrs.cmd=jrs.get_subnodes");
writer.close();
huc.getHeaderField(0);
//get the response content from the server.
InputStream inStream = uc.getInputStream();
if (inStream != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
String inputLine;
while (null != (inputLine = reader.readLine())) {
System.out.println(inputLine);
}
}
}
When using the Server API to perform tasks on resources in the server resource tree, you need to specify the full path of the resources in the code. Below are the rules:
- If the resource is in the Public Reports folder in the server resource tree, the path should be started with "/". For example, for the /Public Report/SampleReports folder, the path is "/SampleReports".
- If the resource is in the My Reports folder in the server resource tree, the path should be started with "/USERFOLDERPATH/username/" (change username to the real user name with which you log onto Logi JReport Server). For example, suppose your server login user name is Jim and you want to access the /My Reports/Shipments folder, the path in the URL is "/USERFOLDERPATH/Jim/Shipments".
Below shows using the Server API to perform some specific tasks. For detailed usage about the Server API, you can refer to the Logi JReport Javadoc in <install_root>\help\api
.
- Creating and Getting Instances
- Using JSP with a Dedicated Machine
- Using RMI in Logi JReport Server
- Working with Resource Versions
- Changing the Runtime Database Connection
- Scheduling a Report Task
- Scheduling a Customized Task Using User Task
- Applying TaskListener
- Writing Customized Load Balancing Algorithm
- Setting Server Reporthome and Properties in a Java EE Environment
- Loading User Data Source Classes at Runtime
- Applying a User Defined CSS to an HTML Result File
- Specifying Parameter Values
- Specifying Report Running Properties in the Session
- Tracing Server Resource Change Events
- Configuring the Security Cache System
- Customizing the Web Report Studio Toolbar
- Customized Implementation of the Security API
- Advanced Running Reports Using the On-Demand API
- Applying the Implementations of the Dashboard Listener API
- Using the NLS API
- Dynamic Connection API
- Dynamic Security API
- Information Bus API