Login  Register

Re: Re: colocating *.jsp (and *.php) with xforms apps files

Posted by DL on Dec 18, 2010; 1:08pm
URL: https://discuss.orbeon.com/colocating-jsp-and-php-with-xforms-apps-files-tp3070304p3093651.html

For information to anyone interested in experimenting with php as well as jsp ..

I copied into web-inf\lib\ these *.jars from quercus.caucho.com.

quercus.jar, resin.jar, resin-util.jar

(note: LifeRay also uses quercus php interpreter for php portlets)


In web.xml I put the <url-pattern> and <servlet-mapping> in this pecking order

quercus
orbeon

...

    <filter-mapping>
        <filter-name>orbeon-xforms-filter</filter-name>
        <url-pattern>/xforms-php/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>


    <servlet>
    <servlet-name>Quercus Servlet</servlet-name>
    <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>


    <init-param>
      <param-name>ini-file</param-name>
      <param-value>WEB-INF/php.ini</param-value>
    </init-param>

    </servlet>

    <servlet-mapping>
      <servlet-name>Quercus Servlet</servlet-name>
      <url-pattern>*.php</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
      <welcome-file>index.php</welcome-file>
    </welcome-file-list>


...


Next I created an xforms-php folder (same level as xforms-jsp folder) and placed this hello.php file.


<?php

header("Content-type: application/xhtml+xml");

$string='<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xhtml:head>
<xhtml:title>Hello Orbeon and Quercus World Classic</xhtml:title>
</xhtml:head>
<xhtml:body>
<xhtml:instance id="test">
<xhtml:p>Hello Orbeon and Quercus World</xhtml:p>
</xhtml:instance> 
</xhtml:body>
</xhtml:html>
';


echo $string;

?>


Restarted server.

I could then launch http://localhost:8080/orbeon/xforms-php/hello.php

I can now create xforms in php inside orbeon and write these *.xhtml files into apps folder.

i.e. not going so far (yet) as to actually embed php in xhtml files.

...

Another approach is to keep quercus outside orbeon and deploy quercus.war as a separate *.war in tomcat.   This avoids the need to edit web.xml and import *.jars etc.   But having quercus jars inside orbeon allows files to be created and written into different folders.