From: <php...@li...> - 2007-01-04 22:59:21
|
A couple more questions, then... On 1/4/07, php...@li... < php...@li...> wrote: > > Hi James, > > > I had thought since the JavaBridge *was* running > > under Tomcat that I had > > access to everything a Servlet would as well. > > Only if you access it through the servlet. Just direct > your browser to port 8080 or set up mod_jk to forward > everything to Tomcat. Okay, that makes sense: pages called directly from my AS will of course be running in a Servlet context. > - but now I'm less certain I understand the exact > > relationship between PHP, > > a Java call, and Tomcat. > > Well it's quite simple. If you call > > http://localhost:8080/JavaBridge/sessionSharing.jsp > > tomcat creates a servlet from the JSP file and i > nvokes it. For PHP requests this is similar: > > http://localhost:8080/JavaBridge/sessionSharing.php > > invokes a servlet which creates the HTML pages and > then delegates to PHP to fill in the content. > > If you call > > http://localhost/sessionSharing.php > > then Apache (or IIS) renders and returns the HTML > page. > Tomcat doesn't even see this request. What if I call http://localhost/testJava.php and testJava.php file includes the (pure Java) PHP/Java bridge and makes a call on a new Java object. This behavior relies on the JavaBridge Servlet running in the AS (in my case: Tomcat). (This is setup in my php.ini, of course.) If the JavaBridge servlet is not running then the Java call(s) will fail. So in this instance, Tomcat *does* see the request, or at least the Java portions of it, but the java_context() isn't established(?). > I'm trying to use a set of Java classes that were > > designed to run as a > > Servlet. (I want to use PHP to write the front-end > > pages and Java to do the > > "heavy lifting" in the back.) > > > > My final call to one of the class methods is > > $exportControl->processHttpdRequest($req, $resp, > > $servlet, null) > > This shouldn't be a problem. Just replace the JSP > logic with PHP and you're done. Which I've done a lot of, and it seems to be working well. The issue though, is some of the Java classes I'm using want to write out (D)HTML using objects that exist in the Servlet context - obviously that won't work if being called from Apache -> PHP -> Tomcat Java/Bridge. I suppose my other option would be to run the PHP file from Tomcat instead of Apache... that may not be so bad, but it feels like then I'm just a step away from using pure Servlets + JSP and I could drop PHP entirely. :) Regards, > Jost Boekemeier > > > <https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users> |