You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(6) |
Nov
(8) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(19) |
Feb
(15) |
Mar
(10) |
Apr
(8) |
May
(7) |
Jun
(9) |
Jul
(13) |
Aug
(31) |
Sep
(111) |
Oct
(52) |
Nov
(72) |
Dec
(42) |
| 2006 |
Jan
(21) |
Feb
(32) |
Mar
(33) |
Apr
(24) |
May
(15) |
Jun
(40) |
Jul
(32) |
Aug
(19) |
Sep
(38) |
Oct
(37) |
Nov
(63) |
Dec
(37) |
| 2007 |
Jan
(18) |
Feb
(39) |
Mar
(69) |
Apr
(49) |
May
(71) |
Jun
(59) |
Jul
(71) |
Aug
(85) |
Sep
(46) |
Oct
(14) |
Nov
(25) |
Dec
(56) |
| 2008 |
Jan
(24) |
Feb
(77) |
Mar
(104) |
Apr
(44) |
May
(41) |
Jun
(11) |
Jul
(31) |
Aug
(59) |
Sep
(44) |
Oct
(86) |
Nov
(66) |
Dec
(93) |
| 2009 |
Jan
(88) |
Feb
(41) |
Mar
(49) |
Apr
(135) |
May
(22) |
Jun
(31) |
Jul
(60) |
Aug
(71) |
Sep
(76) |
Oct
(18) |
Nov
(52) |
Dec
(20) |
| 2010 |
Jan
(8) |
Feb
(50) |
Mar
(35) |
Apr
(48) |
May
(46) |
Jun
(84) |
Jul
(38) |
Aug
(61) |
Sep
(51) |
Oct
(31) |
Nov
(17) |
Dec
(18) |
| 2011 |
Jan
(51) |
Feb
(14) |
Mar
(17) |
Apr
(23) |
May
(15) |
Jun
(11) |
Jul
(5) |
Aug
(5) |
Sep
(15) |
Oct
(8) |
Nov
(5) |
Dec
(25) |
| 2012 |
Jan
(2) |
Feb
(4) |
Mar
(6) |
Apr
(9) |
May
(27) |
Jun
(32) |
Jul
(36) |
Aug
(10) |
Sep
(16) |
Oct
(3) |
Nov
(13) |
Dec
(7) |
| 2013 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(9) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
|
Mar
|
Apr
(10) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2018 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
|
2
(1) |
3
(1) |
|
4
|
5
(3) |
6
(6) |
7
(6) |
8
(10) |
9
(6) |
10
|
|
11
(5) |
12
(5) |
13
(1) |
14
|
15
(2) |
16
(2) |
17
(4) |
|
18
(3) |
19
(3) |
20
(7) |
21
(5) |
22
(7) |
23
(1) |
24
(4) |
|
25
|
26
(3) |
27
(2) |
28
(1) |
29
|
30
|
31
|
|
From: <php...@li...> - 2009-01-11 19:34:03
|
Hi Jost,
o.k., we're coming closer:
Your proposal is about the same I had already described in the attached file of my very first email.
I've now aligned it with your example.
-----------------------------------------------------------
Java looks like:
package php.java.bridge;
import java.lang.reflect.Proxy;
import php.java.bridge.Request.AbortException;
public class Test2 {
public void call(Object $cca, Object $ccb) {
PhpProcedure cca = (PhpProcedure)Proxy.getInvocationHandler($cca);
PhpProcedure ccb = (PhpProcedure)Proxy.getInvocationHandler($ccb);
try {
cca.invoke( $cca, "invokeA", new Object[]{ ccb } );
} catch (AbortException ae) {
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
final String[] initArgs = {"LOCAL", "6", "javabridge_simple_callback.log"};
try {
(new Standalone()).init(initArgs);
} catch (Throwable t) {
t.printStackTrace();
System.exit(9);
}
}
}
-----------------------------------------------------------
PHP looks about this:
class a {
function invokeA($b) {
echo $b->invokeB();
}
}
class b {
function invokeB() {
echo "class b";
}
}
$c = new Java("php.java.bridge.Test2");
$a = java_closure(new a());
$b = java_closure(new b());
$c->call($a, $b)
-----------------------------------------------------------
If I run this then the log-file shows:
1. new Java("php.java.bridge.Test2"):
--> <C v="php.java.bridge.Test2" p="I" ></C>
<-- <O v="1" m="php.java.bridge.Test2" p="O" n="T"/>
=> $c has Java-ID="1"
2. java_closure(new a()):
--> <I v="0" m="makeClosure" p="I" />
--> <L v="2513895" p="O" />
--> </I>
<-- <O v="2" m="php.java.bridge.PhpProcedureProxy" p="O" n="T"/>
=> $a has Java-ID="2"
3. java_closure(new b()):
--> <I v="0" m="makeClosure" p="I" />
--> <L v="2513278" p="O" />
--> </I>
<-- <O v="3" m="php.java.bridge.PhpProcedureProxy" p="O" n="T"/>
=> $b has Java-ID="3"
4. call($a, $b):
--> <I v="1" m="call" p="I" />
--> <O v="2" />
--> <O v="3" />
--> </I>
=> calling the method with the correct IDs ("2" and "3")
5. invokeA():
<-- <A v="2513895" p="aW52b2tlQSgp" m="aW52b2tlQSgp" n="1"><P><O v="4" m="php.java.bridge.PhpProcedure" p="O" n="T"/></P></A>
=> ID now passed back is "4" instead of "3"!
So, the PhpProcedure passed to invokeA() is a new one.
(which in turn causes invokeB() to fail...)
Did I find a bug here?
Regards Jürgen
|
|
From: <php...@li...> - 2009-01-11 17:48:32
|
Hi Jost, Thanks for the information. I added a statement: echo java_inspect($reportBody); And this is what I saw in my output: -------------------- [class [B: Constructors: Fields: Methods: public native int java.lang.Object.hashCode() public final native java.lang.Class java.lang.Object.getClass() public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException public final void java.lang.Object.wait() throws java.lang.InterruptedException public boolean java.lang.Object.equals(java.lang.Object) public java.lang.String java.lang.Object.toString() public final native void java.lang.Object.notify() public final native void java.lang.Object.notifyAll() Classes: ] -------------------- To my untrained eye, that looks like the methods and fields of a plain old java object, not an array of bytes. I then just made the call to java_values explicit: $reportBody = java_values($reportBody); and the file was saved as expected. Thanks again for your help! Dan On 1/9/2009 8:15 AM, php...@li... wrote: > Hi, > >> [[o:array_of_B]:"[B@3a0b2771"] > > it is an array of class B (whatever B is) rather than a byte array or a String. Please see: > > echo java_inspect($javaObject); > > for details. > > You can convert any java object to a string using java_cast($obj, "S") provided it contains a toString() method. Please see the PHP/Java Bridge API for details: http://php-java-bridge.sourceforge.net/pjb/docs/php-api/index.html > > > Regards, > Jost Boekemeier > > > > > > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users |
|
From: <php...@li...> - 2009-01-11 15:12:46
|
Hi,
I have added a new FAQ entry for this:#
<h4>What does "The requested method PUT is not allowed ... at localhost Port 80" mean?</h4>
<p>It means that <code>request.getServerPort()</code> is lying. Port 80 is privileged and therefore cannot be the servlet engine's server port.</p>
<p>If you use the AJP connector, for example via <code>ProxyPassMatch ^(/.*\.jsp)$ ajp://127.0.0.1$1</code>, set the correct <code>proxyPort</code> in <code>tomcat/conf/server.xml</code>. Example:
</p><blockquote>
<code>
<!-- Define an AJP 1.3 Connector on port 8009 --><br>
- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /><br>
+ <Connector port="8009" protocol="AJP/1.3" proxyPort="8080" redirectPort="8443" /><br>
</code>
</blockquote>
Please see the <a href="http://127.0.0.1:8080/docs/config/ajp.html#Proxy%20Support">AJP documentation</a><a> for details.
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2009-01-11 15:07:37
|
Hi,
> But I wanted to invoke a method with its name given as a
> String
Well, use the Java reflection API.
Another possibility is to re-use the PHP/Java Bridge PhpProcedure:
cca.invokeA(ccb);
is equivalent to:
((PhpProcedure)Proxy.getInvocationHandler($cca))).invoke($cca, "invokeA", new Object[]{ccb});
Note the ccb, it has been resolved using the interface IB. If you want to invoke it dynamically, too, use the same procedure as above.
This part of the PHP/Java Bridge API and implementation won't change in the future, so you may use the above code within your application.
A complete example:
package test;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.OutputStreamWriter;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class TestGetInterface {
/**
* @param args
*/
public static void main(String[] args) throws Throwable {
//System.setProperty("php.java.bridge.default_log_file", "");
//System.setProperty("php.java.bridge.default_log_level", "3");
new TestGetInterface().doWork();
}
private ScriptEngine scriptEngine;
String classA = "class A{function toString(){return '::A';} function invokeA($b){$b->invokeB();}}\n";
String classB = "class B{function toString(){return '::B';} function invokeB(){echo '::B';}}\n";
String test = "<?php "+classA+classB+" $thiz=java_context()->getAttribute('thiz');\n$thiz->call(java_closure(new A()), java_closure(new B())); ?>";
private void doWork() throws Throwable {
scriptEngine = new ScriptEngineManager().getEngineByName("php-invocable");
scriptEngine.put("thiz", this);
ByteArrayOutputStream out;
OutputStreamWriter writer;
scriptEngine.getContext().setWriter(writer = new OutputStreamWriter(out = new ByteArrayOutputStream()));
scriptEngine.eval(test);
((Closeable)scriptEngine).close();
writer.close();
if(!"::B".equals(out.toString())) {
System.err.println("test failed");
System.exit(1);
}
System.out.println("test okay");
System.exit(0);
}
interface IA { public void invokeA(IB ccb); };
interface IB { public void invokeB(); };
public void call(Object $cca, Object $ccb) throws Throwable {
IA cca = (IA) ((Invocable)scriptEngine).getInterface($cca, IA.class);
IB ccb = (IB) ((Invocable)scriptEngine).getInterface($ccb, IB.class);
//cca.invokeA(ccb);
((php.java.bridge.PhpProcedure)java.lang.reflect.Proxy.getInvocationHandler($cca)).invoke($cca, "invokeA", new Object[]{ccb});
}
}
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2009-01-11 12:25:38
|
Hi Jost,
thanks for your answer, but you don't seem to get what I wanted to do:
You are showing me how to call testA() on an already existing PHP
object.
But I wanted to invoke a method with its name given as a String, so:
not: A.testA(B)
but: A.invokeMethod("testA", B)
Therefore I do not see why the Java part would need to know about the
methods available on A.
The only thing it has to do is:
- find object A in PHP (formerly created with "java_closure( new A() )")
- find object B in PHP (formerly created with "java_closure( new B() )")
- tell object A to invoke a method (given as a generic String, here:
"testA") with object B as parameter.
If I look at the Javadoc of the Java script-api, it says:
/**
* Invokes a procedure on an object which already defined in the
* script using the array of objects as its arguments set.
*
* @param methodName name of the procedure to be invoked
* @param thiz object on which the procedure is called
* @param args arguments set for the procedure
* @return resultant object after the execution of the
* procedure
* @throws ScriptException if the invocation of the procedure
* fails
*/
public Object invokeMethod(Object thiz,String methodName,Object[] args)
throws
ScriptException, NoSuchMethodException;
=> That's exactly what I want to do, isn't it?
It does not say that I first have to use getInterface() in order to
proof whether "thiz" understands method "methodName".
It also doesn't say that the args are not allowed to be script proxies
as well.
So, do I still get something wrong here or is this just not supported by
the PHP-Java-bridge?
Regards Juergen
|