Skip to content

Commit fe00cfa

Browse files
author
jost_boekemeier
committed
Release-5-2-1
1 parent 9b4c12b commit fe00cfa

324 files changed

Lines changed: 9113 additions & 6605 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2008-03-16 Jost Boekemeier <jostb@intern>
2+
3+
* server/META-INF/java/JavaProxy.inc (Java): correct type: use
4+
$this->__cancelProxyCreationTag
5+
6+
* java.c (PHP_MSHUTDOWN_FUNCTION, PHP_MINIT_FUNCTION): Workaround
7+
for a PHP/Apache 2.2.8 bug
8+
9+
* server/php/java/script/InvocablePhpServletScriptEngine.java
10+
(InvocablePhpServletScriptEngine): Use URI instead of URL in order
11+
to properly URLEncode the file path.
12+
13+
* server/php/java/script/PhpServletScriptEngine.java
14+
(eval): Use URI instead of URL in order
15+
to properly URLEncode the file path.
16+
17+
* install.sh.in: Install java/Java.inc
18+
19+
* VERSION, php-java-bridge.spec: Version 5.2.1 released
20+
121
2007-12-09 Jost Boekemeier <jostb@intern>
222

323
* server/php/java/script/InvocablePhpServletScriptEngine.java

FAQ.html

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,26 @@ <H4>What about portability?</H4>
3434
</p>
3535

3636
<H4>Do I need a Java Application Server or Servlet Engine?</H4>
37-
<p>Not necessarily. But a servlet engine or J2EE service is easier to
38-
install and to handle than a standalone Java service.
37+
<p>Java needs an execution environment. Although there's a "java.so"
38+
and a "php_java.dll", which can start Java as a sub process of a HTTP
39+
server, a servlet engine or J2EE service is <a href="http://tomcat.apache.org">easier to install</a> and to
40+
handle than a standalone Java process started from some HTTP server.
41+
</p>
42+
<p>
43+
You can also add PHP support to your Java application by adding the
44+
following line to its main class:
45+
<blockquote>
46+
<code>
47+
static final php.java.bridge.JavaBridgeRunner runner = php.java.bridge.JavaBridgeRunner.getRequiredInstance(8087);
48+
</code>
49+
</blockquote>
50+
The above code opens the port 8087, so that local PHP scripts can call
51+
methods/procedures from your Java application, as long as your Java
52+
application is running.
53+
</p>
54+
<p>The third option is the standard JSR 223 script interface, which
55+
allows one to execute PHP code/scripts from Java applications.
3956
</p>
40-
4157
<H4>Ho do I enable logging?</H4>
4258
<p>
4359
Copy <code>log4j.jar</code> into <code>java.ext.dirs</code>. Example for JDK 6:
@@ -97,16 +113,42 @@ <H4>What's the difference between SERVLET_LOCAL:8080 and INET_LOCAL:8080?</H4>
97113
<p>INET_LOCAL always uses local TCP socket communication.</p>
98114

99115
<H4>Whenever I reboot my computer I have to start the bridge back end again. How can I automate this?</H4>
100-
<p>Download and install a servlet engine or J2EE server, for example tomcat.</p>
116+
<p>Download and install a servlet engine or J2EE server as a Windows
117+
or Unix service.</p>
101118

102119
<H4>Do I have to require Java.inc in each of my scripts? Isn't that very slow?</H4>
103-
<p>The PHP/Java Bridge library <code>Java.inc</code> must be included before it can be used. Therefore the scripts should contain the statement
120+
<p>In order to communicate with Java, a PHP "Java" class definition is needed. Here's a simple PHP "Java" class definition which fits into one line:
121+
<blockquote>
122+
<code>
123+
&lt;?php<br>
124+
// The following is the "Java" class definition, stripped down to fit into one line<br>
125+
// To use this sample start Java with: java -jar JavaBridge.jar INET:9267<br>
126+
// Or enable java.so or php_java.dll, which automatically start the above<br>
127+
// process Then type: php sample.php<br>
128+
//<br>
129+
class P {const Pc="&lt;C v=\"%s\" p=\"I\"&gt;", PC="&lt;/C&gt;"; const Pi="&lt;I v=\"%d\" m=\"%s\" p=\"I\"&gt;", PI="&lt;/I&gt;"; const Ps="&lt;S v=\"%s\"/&gt;", Pl="&lt;L v=\"%d\" p=\"%s\"/&gt;", Po="&lt;O v=\"%d\"/&gt;"; private $c; function str($s){fwrite($this-&gt;c, sprintf(self::Ps, $s));} function obj($s){fwrite($this-&gt;c, sprintf(self::Po, $s-&gt;java));} function __construct(){$this-&gt;c=fsockopen("127.0.0.1",9267);} function cBeg($s){fwrite($this-&gt;c, sprintf(self::Pc, $s));} function cEnd(){fwrite($this-&gt;c, self::PC);} function iBeg($o, $m){fwrite($this-&gt;c, sprintf(self::Pi, $o, $m));} function iEnd(){fwrite($this-&gt;c, self::PI);} function val($s){if(is_object($s))$this-&gt;obj($s);else $this-&gt;str((string)$s);} function res(){$r=sscanf(fread($this-&gt;c, 8192),"%s v=\"%[^\&quot;]\"");return $r[1];}} class Java {var $java, $p; function __construct() {if(!func_num_args()) return; $this-&gt;p=new P(); $ar=func_get_args(); $this-&gt;p-&gt;cBeg(array_shift($ar)); foreach($ar as $arg) $this-&gt;p-&gt;val($arg); $this-&gt;p-&gt;cEnd(); $ar = sscanf($this-&gt;p-&gt;res(), "%d"); $this-&gt;java=$ar[0];} function __call($meth, $args) {$this-&gt;p-&gt;iBeg($this-&gt;java, $meth); foreach($args as $arg) $this-&gt;p-&gt;val($arg); $this-&gt;p-&gt;iEnd(); $proxy = new Java(); $ar = sscanf($this-&gt;p-&gt;res(), "%d"); $proxy-&gt;java=$ar[0]; $proxy-&gt;p=$this-&gt;p; return $proxy;} function toString() {$this-&gt;p-&gt;iBeg("", "castToString"); $this-&gt;p-&gt;val($this); $this-&gt;p-&gt;iEnd(); return base64_decode($this-&gt;p-&gt;res());}}<br>
130+
<br>
131+
// Test<br>
132+
$i1 = new Java("java.math.BigInteger", "1");<br>
133+
$i2 = new Java("java.math.BigInteger", "2");<br>
134+
$i3 = $i1-&gt;add($i2);<br>
135+
echo $i3-&gt;toString() . "\n";<br>
136+
<br>
137+
?&gt;<br>
138+
</code>
139+
</blockquote>
140+
</p>
141+
<p>The above simple "Java" class assumes that some Java VM has been
142+
started on host "127.0.0.1", port "9267". And it cannot handle values
143+
larger than 8192 bytes. Therefore the PHP/Java Bridge
144+
library <code>Java.inc</code> should be used. Scripts should contain
145+
the statement
104146
<blockquote>
105147
<code>
106148
&nbsp;&nbsp;require_once("...java/Java.inc");
107149
</code>
108150
</blockquote>
109-
at the beginning of the script. PHP compiles and caches PHP scripts, the <code>Java.inc</code> library is loaded only once.
151+
at the beginning of each script. PHP compiles and caches PHP scripts, the <code>Java.inc</code> library is loaded only once.
110152
</p>
111153

112154
<H4>Can I use Java libraries without installing java?</H4> <p>Yes. On a GNU operating system (e.g.: GNU/Linux, GNU/windows (aka "cygwin"), ...) you can use the GCC compiler to compile Java classes to native code.
@@ -115,6 +157,12 @@ <H4>Can I use Java libraries without installing java?</H4> <p>Yes. On a GNU oper
115157
<code>libgcj</code> library, which is part of the GNU gcc compiler. This library also uses much less system
116158
resources (memory, files) than a "real" Java VM.</p>
117159

160+
<H4>I can't load the resource or file from the current working directory!?!</H4>
161+
<p>
162+
The "current working directory" is not useful, as the Java back end may be running
163+
on a different server or from a different working directory. Use a full path or a URL resource instead.
164+
</p>
165+
118166
<H4>I get a blank page or some other error!?!</H4>
119167
<p>
120168
Check the PHP error log, see your <code>php.ini</code> file for details. If the command:
@@ -1124,6 +1172,11 @@ <H4>What about Java 5 varargs?</H4>
11241172
</code>
11251173
</blockquote>
11261174
</p>
1175+
<H4>NULL tests</H4>
1176+
<p>
1177+
Use <code>java_is_null($value)</code> or <code>is_null (java_values ($value))</code> to test for a (Java-) NULL value.
1178+
</p>
1179+
11271180

11281181
</BODY>
11291182
</HTML>

INSTALL.STANDALONE

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ methods from PHP.
1313
Development
1414
-----------
1515

16+
Test the PHP/Java Bridge functionality:
17+
1618
* Right-click on log4j.jar and select "open with Java ..."
1719

1820
* Right-click on JavaBridge.jar and select "open with Java ...". In
@@ -25,18 +27,13 @@ Development
2527
Deployment
2628
----------
2729

30+
Add the PHP/Java Bridge to your Java application(s):
31+
2832
* Extract the JavaBridge.jar library from JavaBridge.war, for example
2933
with the command:
3034

3135
java -classpath JavaBridge.war TestInstallation
3236

33-
* Add the following 3 lines to the main class of your non-J2EE
34-
application:
35-
36-
public static final String JAVABRIDGE_PORT="8087";
37-
static final php.java.bridge.JavaBridgeRunner runner =
38-
php.java.bridge.JavaBridgeRunner.getRequiredInstance(JAVABRIDGE_PORT);
39-
4037
* Add JavaBridge.jar to the main library of you non-J2EE
4138
application. This can be done by adding the following line to your
4239
application's META-INF/MANIFEST.MF:
@@ -45,14 +42,21 @@ application's META-INF/MANIFEST.MF:
4542

4643
It is also possible to simply merge all files into your non-J2EE
4744
application..
48-
49-
* Start your non-J2EE application.
5045

46+
* Add the following 3 lines to the main class of your non-J2EE
47+
application:
48+
49+
public static final String JAVABRIDGE_PORT="8087";
50+
static final php.java.bridge.JavaBridgeRunner runner =
51+
php.java.bridge.JavaBridgeRunner.getRequiredInstance(JAVABRIDGE_PORT);
52+
5153

5254
Call your Java methods from PHP
5355
-------------------------------
5456

55-
* Use the following code to call methods:
57+
* Start your Java application.
58+
59+
* Use the following code to call methods of your running(!) Java application:
5660

5761
<?php require_once("http://localhost:8087/JavaBridge/java/Java.inc");
5862

NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ php-java-bridge NEWS -- history of user-visible changes.
33
Please send bug reports, questions and suggestions to
44
<php-java-bridge-users@lists.sourceforge.net>.
55

6+
Version 5.2.1
7+
8+
* java_isnull() or java_is_null() can be used to test for a Java NULL value.
9+
It is equivalent to is_null (java_values ($javaObject)));
10+
11+
612
Version 5.2.0
713

814
* The Java type has been removed from java.so and php_java.dll. To

RPM-GPG-KEY

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
-----BEGIN PGP PUBLIC KEY BLOCK-----
2-
Version: GnuPG v1.2.1 (GNU/Linux)
2+
Version: rpm-4.4.2.2 (beecrypt-4.1.2)
33

4-
mQGiBEH+KmkRBACXKNmCwzxHjJmafuH+TjhcdyNJqt8EJpljq3wxPfTG3O20/aiB
5-
ysiVlS2zDHp34X1KBo2HCSsiraEYsx7e4RPLAONBxFJHSBYkv6DZfZTsh3S6WUoY
6-
H2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vTe
22-
p2NRCJKssEItrygAn0ja3Yzqa/ZgOSjzaiE4ZLL1IU6Q
23-
=py+v
4+
mQGiBEd3RyARBADja6IVksaKCJRq+T59pFvCod+uJOmLezoZRS52kgHCM6Iw0HHIYvMcgrOO
5+
LsRAAtP8K7GjeWuoK1VN5n5VWlfmHn9j6SB/Ny0AmBm8beUtDiirssVUP0gp+7ojRgTyPpX1
6+
jcoAbaBvIvKGhtu3n1oc5vIN2lOx7Rc4N4JyqrvV5wCgjTJq/1t4gtuOIiIHxcGOhxUhoUcE
7+
AKn9jxE9k3nVqssJzu8cz0W0LNY7cdZbTJApFjWQMY3bnxwY8WhT9AfCJmR5zjnUlvFJbpD6
8+
88t3vZgwtTDnkgr+Gx45dEck2M4tnAdrhhuhQu4kVa7ifF5c+It6SJlnzTelR0AYdr9Lw61E
9+
HzuYGzkUtvN0nSyz8RGo6QokiKeZA/0XDzL1Casp6MAga2pzm0D14ecKb15jWzK7AO/0YjpH
10+
UJLa8iTg2ldG1sLAX4RX2suTbV1inLzUR0Ga3P2Vz3llUVeZ4dtTUu0ebd8rWpp58M0onMM+
11+
pXLfkduDSXA3NavZsMlEArjGdO4czlPxJPCxWyDgmrV3efuXqqDrOeC10bQqSm9zdCBCb2Vr
12+
ZW1laWVyIDxqb3N0X2JvZWtlbWVpZXJAeWFob28uZGU+iGAEExECACAFAkd3RyACGwMGCwkI
13+
BwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDwfdQH84kQcV9hAJ4xvMWBT+7nLgJBTKm9wH0nEaOP
14+
bACeOsuaiW/jrEcYdDjOgpv9EkrRUHQ=
15+
=+Qgh
2416
-----END PGP PUBLIC KEY BLOCK-----

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.2.0
1+
5.2.1

0 commit comments

Comments
 (0)