|
From: <php...@li...> - 2010-04-12 15:21:33
|
Hi,
> I think it should be easier to add PHP extensions to the PHP.
>
> In PHP/Java Bridge 5.1.2 you can add your libraries to
>
> WEB-INF/cgi/<os>-<architecture>/ext
>
> and your custom .ini files to
>
> WEB-INF/cgi/<os>-<architecture>/conf.d
>
> PHP libraries go to
>
> WEB-INF/pear
this has been implemented in PHP/Java Bridge version 6.1.2. Please
check the output from phpinfo() for details.
>From the NEWS file:
Version 6.1.2
* The "servlet engine" built into JavaBridge.jar now handles PHP/Java
Bridge protocol requests as efficient as a real servlet engine back
end;
java -jar JavaBridge.jar SERVLET_LOCAL:8080
now uses HTTP/1.1 Transfer-Encoding: chunked. Example:
telnet localhost 8080
PUT /JavaBridge/servlet.phpjavabridge HTTP/1.1
Host: localhost:8080
Transfer-Encoding: chunked
22
<H p="1" v="java.lang.String"></H>
b
<F p="E" />
0
* It is now easy to use the bridge back-end in an existing
servlet. Example code:
public class MyServlet extends HttpServlet {
...
public String hello() { return "hello from MyServlet"; }
...
protected void doPut (HttpServletRequest req, HttpServletResponse
res) throws ServletException, IOException {
IContextFactory ctx = new RemoteHttpServletContextFactory(this,
getServletContext(), req, req, res);
res.setHeader("X_JAVABRIDGE_CONTEXT", ctx.getId());
res.setHeader("Pragma", "no-cache");
res.setHeader("Cache-Control", "no-cache");
try { ctx.getBridge().handleRequests(req.getInputStream(),
res.getOutputStream()); } finally { ctx.destroy(); }
}
}
If MyServlet listens on localhost:8080/MyWebApp/MyServlet, PHP
scripts can call it:
<?php
define("JAVA_HOSTS", "localhost:8080");
define("JAVA_SERVLET", "/MyWebApp/MyServlet");
require_once("java/Java.inc");
echo java_context()->getServlet()->hello();
?>
=> http://downloads.sourceforge.net/project/php-java-bridge/Binary%20package/php-java-bridge_6.1.2-testing/php-java-bridge_6.1.2_documentation.zip?use_mirror=freefr
Regards,
Jost Bökemeier
|