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
|
3
(3) |
4
|
|
5
(1) |
6
(4) |
7
|
8
(6) |
9
(3) |
10
(1) |
11
(1) |
|
12
|
13
(2) |
14
(3) |
15
(9) |
16
(5) |
17
(3) |
18
|
|
19
|
20
(2) |
21
(5) |
22
(5) |
23
(2) |
24
|
25
|
|
26
|
27
|
28
(4) |
29
(2) |
30
(2) |
|
|
|
From: <php...@li...> - 2006-11-20 18:42:33
|
Hi Verena,
> Why did I capture the top-level environment?
java_closure() without any arguments captures the
top-level environment, creates and returns a Java
proxy for it.
Of cause you could use
invocable.invokeMethod(engine.get(objectBinding),...)
to call a method[1]. But if you don't have more than
one PHP class per php file, this shouldn't be
necessary; you can capture the object directly, which
has the advantage that you don't need to keep a
dictionary of additional symbol->object bindings.
> thought with engine.get("obj")
> I get the PHP object returned
Yes. (you'll get a Java proxy for the PHP object).
> and so the method
> saySomething is invoked on
> that object?
Yes.
> What is the correct syntax to invoke a method on
> MyClass()?
>
> I tried this:
> PhpScriptEngine engine = new PhpScriptEngine();
> String s = "<?php \n";
> s += "require_once 'MyClass.php'; \n";
> s += "java_context()->setAttribute( 'obj',
> java_closure(new MyClass()),
> 100 ); \n";
> s += "?>";
> engine.eval( new StringReader(s) );
> Invocable inv = (Invocable) engine;
> inv.invokeMethod( engine.get("obj"), "saySomething",
> new Object() );
The above script is not invocable. The last line of a
invocable PHP script must contain:
java_context()->call(java_closure());
> java.io.IOException: Bad file descriptor
> at java.io.FileOutputStream.writeBytes(Native
Well, PHP simply terminates after a PHP script is
executed. To keep it, you must suspend it and pass
control back to the Java continuation.
The java_context()->call(kont)
calls the Java continuation with the PHP continuation
as its argument, so that the Java continuation can
call back into the PHP continuation kont whenever
necessary:
kont.call(scriptEngine.getContinuation());
Of course the above PHP<->Java continuation passing
style is hidden behind the JSR223 interfaces. But on
the PHP side the java_context()->call() must exist,
otherwise the PHP script cannot be called from a
(potentially) remote Java script engine interface.
> Yes, it sounds like, but actually I'm not sure how
> to do it. This faces things
> are about the web framework, aren't they?
In practice, yes.
> So how do
> I transform this to a
> J2SE app?
Just create one public PHP class per PHP file. Example
file my/foo.php, my/bar.php
foo.php:
class my_Foo { function toString() {return "foo";} }
java_context()->call(java_closure(new myFoo());
bar.php:
class my_Bar { function toString() {return "bar";} }
java_context()->call(java_closure(new myBar());
Now you need a XML file which describes your PHP
"beans", or simply hard-code the names in your code:
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine foo = m.getEngineByName("php");
foo.eval(new FileReader("my/foo.php"));
ScriptEngine bar = m.getEngineByName("php");
bar.eval(new FileReader("my/bar.php"));
// now you can call methods from the foo and bar
// PHP classes
> No, it instanciates a JavaSript object which has one
> method called hello.
Interesting. I thought that unlike PHP, the JavaScript
object hierarchy is not orthogonal to the Java object
hierarchy.
Regards,
Jost Boekemeier
[1] In the old JSR223 proposal the invokeMethod() and
invokeProcedure() methods where called "invoke()".
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
|
|
From: <php...@li...> - 2006-11-20 15:36:44
|
Am Freitag, 17. November 2006 19:40 schrieb
php...@li...:
> However, you'll get a warning that the instance of
> MyClass is not a Java object. Use
>
> java_closure(new MyClass())
>
> instead.
OK, this is working now without the warning.
>
> > Invocable inv = (Invocable) engine;
> > inv.invokeMethod( engine.get("obj"), "saySomething",
> > new Object() );
>
> You will get a null pointer exception because obj is
> bound to null, see the warning above. Furthermore you
> have captured the top-level environment, but you
> probably want to invoke methods from MyClass().
Why did I capture the top-level environment? I thought with engine.get("obj")
I get the PHP object returned and so the method saySomething is invoked on
that object?
What is the correct syntax to invoke a method on MyClass()?
I tried this:
PhpScriptEngine engine = new PhpScriptEngine();
String s = "<?php \n";
s += "require_once 'MyClass.php'; \n";
s += "java_context()->setAttribute( 'obj', java_closure(new MyClass()),
100 ); \n";
s += "?>";
engine.eval( new StringReader(s) );
Invocable inv = (Invocable) engine;
inv.invokeMethod( engine.get("obj"), "saySomething", new Object() );
and it results in this error message:
Nov 20 10:55:20 JavaBridge ERROR: An exception occured: java.io.IOException:
Bad file descriptor
java.io.IOException: Bad file descriptor
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:109)
at php.java.bridge.Response$Writer.flush(Response.java:125)
at php.java.bridge.Response.flush(Response.java:671)
at php.java.bridge.ClassicResponse.copyResponse(ClassicResponse.java:82)
at php.java.bridge.Request.handleSubRequests(Request.java:607)
at php.java.bridge.PhpProcedure.invoke(PhpProcedure.java:77)
at php.java.bridge.PhpProcedure.invoke(PhpProcedure.java:95)
at php.java.script.PhpScriptEngine.invokeMethod(PhpScriptEngine.java:204)
at Bootstrap.main(Bootstrap.java:39)
Bootstrap.java, line 39 is the last one showed above.
> [...]
>
> return
> ((Invocable)((PhpFacesContext)FacesContext.getCurrentInstance()).getScriptE
>ngine(this, new URL(script))).invoke(name, args);
>
> I think this is exactly what you want. The only
> difference is that the above method calls out to a URL
> instead of a local script file.
Yes, it sounds like, but actually I'm not sure how to do it. This faces things
are about the web framework, aren't they? So how do I transform this to a
J2SE app?
In the code example I can't see how to call a method on a previously
instanciated PHP object. It only uses the invoke Method with 2 parameters
(invokeFunction).
> > String script = "var obj = new Object();
> > obj.hello = function(name)
> > { print('Hello, ' + name); }";
> >
> > Any chance todo something similar with PHP?
>
> It is certainly possible to automatically call
> java_closure(), when a php object is passed to a Java
> procedure. But for several reasons we've decided to
> require java_closure(php_object). Furthermore, if I
> understand the above code correctly, the "new
> Object()" above instanciates a Java object, not an
> object from the js script interpreter.
No, it instanciates a JavaSript object which has one method called hello. But
if the only difference to this snippet and the possibiblities of the php-java
bridge is the automatic call to java_close(), it is similar enough for my
project.
Regards,
Verena
|