|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.inet.report.ReportBridge
public class ReportBridge
This class bridges native applications with i-net Clear Reports. It can be used to control i-net Clear Reports from non-java object systems such as Windows COM, or PHP.
<script LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Sub Application_OnStart
'*** Initialize the JVM
Dim JvmCtl
Set JvmCtl = Server.CreateObject("J2EECAS.JvmControl")
JvmCtl.Classpath = c:\ClearReports.jar
JvmCtl.StartJvm
'*** Create a JavaServices object
Dim JS
Set JS = Server.CreateObject("J2EECAS.JavaServices")
'*** Create a proxy through which static methods
on the
'*** com.inet.report.ReportBridge class can be called
Dim ClearReports
Set ClearReports =
JS.GetJavaStaticsFor("com.inet.report.ReportBridge")
Set Application("ClearReports") = ClearReports
End Sub
</script>
default.asp
<%
Option Explicit
Dim ClearReports
Set ClearReports = Application("ClearReports")
'*** request a container for parameters
Dim Parameters
Parameters = ClearReports.ParameterContainer
'*** put the user parameter in the container
Dim Key
For Each Key In Request.Form
Parameters.put Key, CStr( Request.Form(Key) )
Next
For Each Key In Request.QueryString
Parameters.put Key, CStr( Request.QueryString(Key) )
Next
'*** put the needed server enviroment in the parameter container
Dim url
url = "http://" & Request.ServerVariables("HTTP_HOST")
Parameters.put "http_server_port", url
Parameters.put "http_server", url
Parameters.put "context", CStr( Request.ServerVariables("URL") )
Parameters.put "locale", CStr( Request.ServerVariables(
"HTTP_ACCEPT_LANGUAGE" ) )
Dim PageData
PageData = ClearReports.RequestContext( Parameters )
Response.BinaryWrite( PageData )
Response.ContentType = Parameters.get( "content" )
Response.end
%>
<?php
// request a java properties object
$p=new Java("java.util.Properties");
foreach ($HTTP_POST_VARS as $key => $val)
{
$p->put($key, $val);
}
foreach ($HTTP_GET_VARS as $key => $val)
{
$p->put($key, $val);
}
// add the needed server enviroment in the parameter container
$url="http://".$_SERVER["SERVER_NAME"];
$p->put("http_server_port",
$url.":".$_SERVER['SERVER_PORT']);
$p->put("http_server", $url);
$p->put("context", $_SERVER['SCRIPT_NAME']);
$p->put("locale",
array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] :
"en");
// create the report bridge to handle the request
$report_bridge=new Java("com.inet.report.ReportBridge");
$page_data=$report_bridge->RequestContext($p);
header("Content-type: ".$p->getProperty("content"));
print $page_data;
?>
| Constructor Summary | |
|---|---|
ReportBridge()
Creates a new Report bridge and connect to the i-net Clear Reports. |
|
ReportBridge(java.util.Properties props)
Creates a new Report bridge with a given properties and connect to the i-net Clear Reports. |
|
| Method Summary | |
|---|---|
static java.util.Properties |
ParameterContainer()
A helper routine which creates a java.util.Properties |
static java.util.Vector |
ParameterList()
A helper routine which creates a java.lang.Vector |
static byte[] |
RequestContext(java.util.Properties props)
This method takes a properties object which should contain at least the keys "report", "http_server_port", "context", "language". |
void |
dispose()
Clear all resources |
void |
execute()
Executes the bridge, if necessary. |
Engine |
getEngine()
After you have created a ReportBridge, you can use this method to obtain the engine. |
byte[] |
getResponseData()
Returns the page data of the page as an byte array. |
static void |
logDebug(java.lang.String msg)
Writes a debug message into the i-net Clear Reports log file. |
static void |
logError(java.lang.String msg)
Writes an error message into the i-net Clear Reports log file. |
static void |
logMessage(java.lang.String msg)
Writes an info string into the i-net Clear Reports log file. |
| Constructor Detail |
|---|
public ReportBridge()
ReportBridge(Properties)public ReportBridge(java.util.Properties props)
props - The properties for the report (report=...&dll=...) that should be created locally.| Method Detail |
|---|
public static java.util.Properties ParameterContainer()
public static java.util.Vector ParameterList()
public static byte[] RequestContext(java.util.Properties props)
props - the HTTP request properties
public Engine getEngine()
Properties props = new Properties();
props.put("report", "file:c:/test.rpt");
ReportBridge bridge=new ReportBridge(props);
Engine e = bridge.getEngine();
if(e!=null) {
// use RDC calls to modify the engine
bridge.execute();
}
byte b[] = bridge.getResponseData();
execute()public void execute()
Properties props = new Properties();
props.put("report", "file:c:/test.rpt");
ReportBridge bridge=new ReportBridge(props);
Engine e = bridge.getEngine();
if(e!=null) {
// use RDC calls to modify the engine
bridge.execute();
}
byte b[] = bridge.getResponseData();
public byte[] getResponseData()
Properties props = new Properties();
props.put("report", "file:c:/test.rpt");
ReportBridge bridge=new ReportBridge(props);
Engine e = bridge.getEngine();
if(e!=null) {
// use RDC calls to modify the engine
bridge.execute();
}
byte b[] = bridge.getResponseData();
System.out.println(props.getProperty("content")); // --> application/crystalclear
public void dispose()
public static void logDebug(java.lang.String msg)
msg - The debug messagepublic static void logError(java.lang.String msg)
msg - The error messagepublic static void logMessage(java.lang.String msg)
msg - The info string
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||