From: <php...@li...> - 2006-09-17 14:44:30
|
> anyway, just to experiment and see if that would get > me anything > interesting. Unfortunately that's raising > exceptions: yes, the servlet doesn't wait for the context anymore, so after one Java() statement the request object is recycled. I have removed the context.waitFor() after 2.0.8 (see line 330 in http://php-java-bridge.cvs.sourceforge.net/php-java-bridge/php-java-bridge/server/php/java/servlet/PhpJavaServlet.java?revision=1.25&view=markup) because the request object isn't really useful at the moment anyway. It doesn't carry any information about the original request, etc. But we could forward the necessary request options and let the servlet wait for the Context, if needed. > <?php > $request = > java_context()->getHttpServletRequest(); > echo $request->toString(); > $uri = $request->getRequestURI(); > ?> > > [o(String):"org.apache.coyote.tomcat4.CoyoteRequestFacade@1707653"] > Fatal error: Uncaught > [o(Exception):"java.lang.Exception: Invoke > failed: [o(CoyoteRequestFacade)]->getRequestURI. > Cause: > java.lang.NullPointerException After the first line the servlet and its associated request object is recycled by tomcat and the bridge runs with a context server which is more than 50 times faster than sending PUT request. You can switch off the pipe and socket context server by running tomcat with the java options: -Dphp.java.bridge.no_pipe_server=true -Dphp.java.bridge.no_socket_server=true (see http://php-java-bridge.sourceforge.net/server/documentation/API/php/java/bridge/http/PipeContextServer.html and http://php-java-bridge.sourceforge.net/server/documentation/API/php/java/bridge/http/SocketContextServer.html) > Is that the expected behaviour, even considering I > am forwarding the > embedded php java() statements? Yes. Even if the Pipe-/SocketContextServer is switched off and the bridge must send a PUT request for each individual Java() statement, the request and response objects are recycled by the servlet engine. This means that you can't store any values there, each PHP Java() statement is executed in a fresh context, only the session store stays the same. > I have a feeling that I am going to need to > implement my own > HttpServletRequest in any case This shouldn't be too difficult. However, I think this is a feature which should also go into the bridge code. I will create a new 3.2.x branch and add this feature there. > Just out of interest, how would I get Tomcat to > interpret the php > pages instead of apache? > - Is there an easy way to implement this with our > current setup (we > have stock apache running php, passing jsp pages to > Tomcat on port > 8080 with jk)? Just forward both, the PHP and the JSP requests. This will invoke the FastCGI machinery, which isn't much slower than Apache (according to my tests it is even faster than Apache's worker MPM). Jost ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de |