Example #1
0
<html>
<body bgcolor="white">
<head>
<title>Sessions Example</title>
</head>
<body>
<h3>Sessions Example</h3>
<?php 
// print session info
$session = $request->session;
$created = new Java("java.util.Date", $session->creationTime);
$accessed = new Java("java.util.Date", $session->lastAccessedTime);
print "Session ID: {$session->id}<br>\n";
print "Created: " . $created->toString() . "<br>\n";
print "Last Accessed: " . $accessed->toString() . "<br>\n";
// set session info if needed
if ($dataName) {
    $session->setAttribute($dataName, $dataValue);
}
// print session contents
print "<P>\n";
print "The following data is in your session:<br>\n";
$e = $session->attributeNames;
while ($e->hasMoreElements()) {
    $name = $e->nextElement();
    $value = $session->getAttribute($name);
    print "{$name} = {$value}<br>\n";
}
?>
<P>
<form action="<?php 
Example #2
0
    $http_server_port = $report->props->getProperty("http_server_port");
    // the script name, e.g.: Sample.php
    $context = $report->props->getProperty("context");
    $currentReportName = strtolower($report->props->getProperty("report", ""));
    if (strlen($currentReportName) == 0) {
        $script = $_SERVER['SCRIPT_FILENAME'];
        // $report_file = "file:" . dirname($script) . "/sample.rpt";
        // $report_file = "file:" . dirname($script) . "$inetreportsfiles/$rptfile.rpt";
        $report_file = "file:" . "{$rptfile}";
        $report->props->put("report", $report_file);
    }
    // the parameters for the report, e.g.: report=foo.rpt&prompt0=1&sf=false&...
    $key = new Java("com.inet.report.ReportKeyFactory", $report->props);
    // echo $querystring = ""; exit;
    // build the URL that the java viewer shall use to send us the request.
    $request_url = $http_server_port . $context . "?" . $key->toString();
    print $request_url;
    ?>
 >

<param name=Archive value=<?php 
    print $report->props->getProperty("http_server_port") . "/{$javalib_folder}/ReportViewer.jar";
    ?>
 >
</applet>
</BODY>
</HTML>
<?php 
}
// must_return_html_page
// http://107.20.246.110:9000/?report=&init=
Example #3
0
# For the following test start the java VM with: 
# java -Dfile.encoding=ASCII -jar JavaBridge.jar INET:0 4 ""
# and run the test as follows:
# php utf8-1.inc | grep '^Gr' | od -c
# =>
# 0000000   G   r 303 274 303 237       G   o   t   t  \n   G   r   ?   ?
# 0000020       G   o   t   t  \n   G   r 374 337       G   o   t   t  \n



<?php 
include_once "java/Java.inc";
java_set_file_encoding("ISO-8859-1");
// the following is rewritten into new String(..., "ISO-8859-1");
$string = new Java("java.lang.String", "Grья Gott");
// decode string into UTF-8
print java_values($string->getBytes("UTF-8")) . "\n";
// decode string using System.getProperty("file.encoding");
print java_values($string->getBytes()) . "\n";
// decode string using file encoding
print java_values($string->toString()) . "\n";
// the following is rewritten into new String(..., "ISO-8859-1");
$string = new Java("java.lang.String", "Grья Gott", 0, 9);
// decode string into UTF-8
print java_values($string->getBytes("UTF-8")) . "\n";
// decode string using System.getProperty("file.encoding");
print java_values($string->getBytes()) . "\n";
// decode string using file encoding
print java_values($string->toString()) . "\n";
 /**
  * Retrieves the field code from a field.
  *
  * @param fieldStart The field start of the field which to gather the field code from.
  */
 private static function getFieldCode($fieldStart)
 {
     $builder = new Java("java.lang.StringBuilder");
     $nodeType = new Java("com.aspose.words.NodeType");
     for ($node = $fieldStart; java_values($node) != null && java_values($node->getNodeType()) != java_values($nodeType->FIELD_SEPARATOR) && java_values($node->getNodeType()) != java_values($nodeType->FIELD_END); $node = $node->nextPreOrder($node->getDocument())) {
         $nodeType = new Java("com.aspose.words.NodeType");
         // Use text only of Run nodes to avoid duplication.
         if (java_values($node->getNodeType()) == java_values($nodeType->RUN)) {
             $builder->append($node->getText());
         }
     }
     return $builder->toString();
 }