From 0527a9afa222da86b00456d0837ff73921224607 Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy Date: Mon, 22 Jul 2002 13:40:12 +0000 Subject: [PATCH] New structure applied to java extension docs, and added some more info to it (short installation and cofiguration info). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@89467 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/java/reference.xml | 294 ++++++++++++++++++++--------------- reference/rsusi.txt | 2 +- 2 files changed, 171 insertions(+), 125 deletions(-) diff --git a/reference/java/reference.xml b/reference/java/reference.xml index 6d00dc1cb0..2a520319c7 100644 --- a/reference/java/reference.xml +++ b/reference/java/reference.xml @@ -1,25 +1,67 @@ - + - Java - PHP / Java Integration + PHP / Java Integration + Java - - There are two possible ways to bridge PHP and Java: you can either - integrate PHP into a Java Servlet environment, which is the more - stable and efficient solution, or integrate Java support into PHP. - The former is provided by a SAPI module that interfaces with the - Servlet server, the latter by the Java extension. - - - PHP 4 ext/java provides a simple and effective means for creating and - invoking methods on Java objects from PHP. The JVM is created using JNI, - and everything runs in-process. Build instructions for ext/java can be - found in php4/ext/java/README. + +
+ &reftitle.intro; + + There are two possible ways to bridge PHP and Java: you can either + integrate PHP into a Java Servlet + environment, which is the more stable and efficient solution, + or integrate Java support into PHP. The former is provided by a SAPI + module that interfaces with the Servlet server, the latter by this + Java extension. + + + The Java extension provides a simple and effective means for creating and + invoking methods on Java objects from PHP. The JVM is created using JNI, + and everything runs in-process. + +
+ +
+ &reftitle.required; + + You need a Java VM installed on your machine to use this extension. + +
+ +
+ &reftitle.install; + + Build instructions for this extension can be found in + php4/ext/java/README. + +
+ +
+ &reftitle.runtime; + + The &php.ini; settings involved in configuring the Java + extension are java.library.path and + java.class.path. + +
- - Java Example - +
+ &reftitle.resources; + &no.resource; +
+ +
+ &reftitle.constants; + &no.constants; +
+ +
+ &reftitle.examples; + + + Java Example + getProperty('java.version').'
'; - print 'Java vendor=' .$system->getProperty('java.vendor').'
'; + print 'Java vendor=' .$system->getProperty('java.vendor').'
'; print 'OS='.$system->getProperty('os.name').' '. $system->getProperty('os.version').' on '. $system->getProperty('os.arch').'
'; @@ -39,11 +81,11 @@ print $formatter->format(new Java('java.util.Date')); ?> ]]> -
-
- - AWT Example - + + + + AWT Example + dispose(); ?> ]]> - - + + - Notes: + Notes: - - - - new Java() will create an instance of a class if - a suitable constructor is available. If no parameters are passed and - the default constructor is useful as it provides access to classes - like java.lang.System which expose most of their - functionallity through static methods. - - - - - Accessing a member of an instance will first look for bean properties - then public fields. In other words, print $date.time - will first attempt to be resolved as $date.getTime(), - then as $date.time. - - - - - Both static and instance members can be accessed on an object with - the same syntax. Furthermore, if the java object is of type - java.lang.Class, then static members of the class - (fields and methods) can be accessed. - - - - - Exceptions raised result in PHP warnings, and &null; results. The - warnings may be eliminated by prefixing the method call with an - "@" sign. The following APIs may be used to retrieve and reset - the last error: + + + + new Java() will create an instance of a class if + a suitable constructor is available. If no parameters are passed and + the default constructor is useful as it provides access to classes + like java.lang.System which expose most of their + functionallity through static methods. + + + + + Accessing a member of an instance will first look for bean properties + then public fields. In other words, print $date.time + will first attempt to be resolved as $date.getTime(), + then as $date.time. + + + + + Both static and instance members can be accessed on an object with + the same syntax. Furthermore, if the java object is of type + java.lang.Class, then static members of the class + (fields and methods) can be accessed. + + + + + Exceptions raised result in PHP warnings, and &null; results. The + warnings may be eliminated by prefixing the method call with an + "@" sign. The following APIs may be used to retrieve and reset + the last error: + + java_last_exception_get + java_last_exception_clear + + + + + + Overload resolution is in general a hard problem given the + differences in types between the two languages. The PHP Java + extension employs a simple, but fairly effective, metric for + determining which overload is the best match. + + + Additionally, method names in PHP are not case sensitive, potentially + increasing the number of overloads to select from. + + + Once a method is selected, the parameters are cooerced if necessary, + possibly with a loss of data (example: double precision floating point + numbers will be converted to boolean). + + + + + + In the tradition of PHP, arrays and hashtables may pretty much + be used interchangably. Note that hashtables in PHP may only be + indexed by integers or strings; and that arrays of primitive types + in Java can not be sparse. Also note that these constructs are + passed by value, so may be expensive in terms of memory and time. + + + + +
+ +
+ Java Servlet SAPI + + The Java Servlet SAPI builds upon the mechanism defined by the Java + extension to enable the entire PHP processor to be run as a servlet. + The primary advanatage of this from a PHP perspective is that web servers + which support servlets typically take great care in pooling and reusing + JVMs. Build instructions for the Servlet SAPI module can be found in + php4/sapi/README. - - java_last_exception_get - java_last_exception_clear - - - - - - Overload resolution is in general a hard problem given the - differences in types between the two languages. The PHP Java - extension employs a simple, but fairly effective, metric for - determining which overload is the best match. - - - Additionally, method names in PHP are not case sensitive, potentially - increasing the number of overloads to select from. - - - Once a method is selected, the parameters are cooerced if necessary, - possibly with a loss of data (example: double precision floating point - numbers will be converted to boolean). - - - - - - In the tradition of PHP, arrays and hashtables may pretty much - be used interchangably. Note that hashtables in PHP may only be - indexed by integers or strings; and that arrays of primitive types - in Java can not be sparse. Also note that these constructs are - passed by value, so may be expensive in terms of memory and time. - - - - - - sapi/servlet builds upon the mechanism defined by ext/java to enable - the entire PHP processor to be run as a servlet. The primary advanatage - of this from a PHP perspective is that web servers which support servlets - typically take great care in pooling and reusing JVMs. Build instructions - for the Servlet SAPI module can be found in - php4/sapi/README. + Notes: - Notes: - - - - - While this code is intended to be able to run on any servlet engine, - it has only been tested on Apache's Jakarta/tomcat to date. Bug - reports, success stories and/or patches required to get this code - to run on other engines would be appreciated. - - - - - PHP has a habit of changing the working directory. sapi/servlet will - eventually change it back, but while PHP is running the servlet engine - may not be able to load any classes from the CLASSPATH which are - specified using a relative directory syntax, or find the work directory - used for administration and JSP compilation tasks. - - - - + + + + While this code is intended to be able to run on any servlet engine, + it has only been tested on Apache's Jakarta/tomcat to date. Bug + reports, success stories and/or patches required to get this code + to run on other engines would be appreciated. + + + + + PHP has a habit of changing the working directory. sapi/servlet will + eventually change it back, but while PHP is running the servlet engine + may not be able to load any classes from the CLASSPATH which are + specified using a relative directory syntax, or find the work directory + used for administration and JSP compilation tasks. + + + + +
&reference.java.functions; diff --git a/reference/rsusi.txt b/reference/rsusi.txt index 74861e1fcf..c70a9af541 100644 --- a/reference/rsusi.txt +++ b/reference/rsusi.txt @@ -65,7 +65,7 @@ imap info ingres-ii ircg -java !no +java ++ ldap !no mail !no mailparse !no